int solve() {
int res = 0;
int x, y[2]; cin >> x >> y[0] >> y[1];
res += (x - 100) / 50;
for (int i = 0; i < 2; i ++) {
int t = y[i];
if (t == 45) res += 2;
else if (t > 32) res ++;
}
return res;
}
int n, m;
int k;
bool a[N][N];
int solve() {
cin >> n >> m >> k;
while (k --) {
int x, y; cin >> x >> y;
a[-- x][-- y] = true;
}
int res = 0;
for (int i = 0; i < n + 1; i ++) {
for (int j = 0; j < m; j ++) {
if (i && a[i - 1][j] || a[i][j]) res ++;
}
}
for (int i = 0; i < n; i ++) {
for (int j = 0; j < m + 1; j ++) {
if (j && a[i][j - 1] || a[i][j]) res ++;
}
}
return res;
}
赛时 ≤ \le ≤ 写成了 < \lt <, T T T 了四发,我就说这复杂度还能 T T T ?
int n, m;
int k;
int a[N], b[N];
ll f[N];
ll solve() {
cin >> n >> m >> k;
for (int i = 0; i < m; i ++) cin >> a[i] >> b[i];
memset(f, -1, sizeof f);
f[k - 1] = 0;
queue<int> q;
q.push(k - 1);
while (!q.empty()) {
auto u = q.front();
q.pop();
for (int i = 0; i < m; i ++) {
int v = (u + a[i]) % n;
if (f[v] != -1 && f[v] <= f[u] + b[i]) continue;
f[v] = f[u] + b[i];
q.push(v);
}
}
return f[n - 1];
}
int n, m;
int a[N];
int solve() {
cin >> n;
int c1 = 0;
for (int i = 0; i < n; i ++) cin >> a[i], c1 += a[i] == 1;
if (!(n - c1) || !c1) return n;
int res = 0;
int r = n - 1;
for (int i = n - 2; i >= 0; i --)
if (a[i] != a[i + 1]) res ++, r = i, i --;
res += r;
return res;
}
int n, m;
int solve() {
cin >> n;
set<int> e[n + 1];
set<int> st;
for (int i = 0; i < n; i ++) {
int x; cin >> x;
e[x].insert(i);
st.insert(x);
}
if (st.size() == 1) return n;
m = n;
int res = 0;
while (m) {
int r = n;
for (auto i : st)
if (e[i].size()) r = min(r, *-- e[i].end());
res ++;
vector<int> de;
for (auto i : st) {
while (e[i].size() && *-- e[i].end() >= r)
e[i].erase(-- e[i].end()), m --;
if (e[i].empty()) de.emplace_back(i);
}
for (auto i : de) st.erase(i);
}
return res;
}
int n, m;
int a[N];
ll solve() {
cin >> n;
for (int i = 0; i < n; i ++) cin >> a[i];
sort(a, a + n);
ll res = 0;
for (int i = 0; i < n; i ++) res += (ll)a[i] * i << 2;
return res;
}
int n, m;
int a[N];
ll solve() {
cin >> n;
for (int i = 0; i < n; i ++) cin >> a[i];
sort(a, a + n);
ll res = 0;
for (int i = 0; i < n; i ++) res += (ll)min(a[0] << 3, a[i] << 2) * (n - i - 1);
return res;
}
审题审错了,赛时当 a , b , c , d , _ a,b,c,d,\_ a,b,c,d,_ 数量未知来做了,把 easy 当成 hard 来做了(
int n, m;
string s;
int y;
int solve() {
cin >> n >> s >> y;
set<int> st;
for (char a = '0'; a <= '9'; a ++)
for (char b = '0'; b <= '9'; b ++)
for (char c = '0'; c <= '9'; c ++)
for (char d = '0'; d <= '9'; d ++)
for (char _ = '0'; _ <= '9'; _ ++) {
if (a == b || a == c || a == d || b == c || b == d || c == d) continue;
int x = 0;
string t = s;
for (auto &i : t) {
if (i == 'a') i = a;
if (i == 'b') i = b;
if (i == 'c') i = c;
if (i == 'd') i = d;
if (i == '_') i = _;
x = x * 10 + i - '0';
}
if (to_string(x).size() == n && x <= y && x % 8 == 0) st.insert(x);
}
return st.size();
}