# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
125957 | 2019-07-06T15:15:44 Z | EntityIT | Coin Collecting (JOI19_ho_t4) | C++14 | 2 ms | 380 KB |
#include<bits/stdc++.h> using namespace std; const int N = (int)1e5 + 5; int n, x[N << 1], y[N << 1], cnt[2], z[N << 1]; long long ans; int main () { scanf("%d", &n); for (int i = 1; i <= (n << 1); ++i) scanf("%d %d", x + i, y + i), z[i] = (i + 1) / 2; for (int i = 1; i <= (n << 1); ++i) { if (y[i] < 2) ans += 1 - y[i], ++cnt[0]; else ans += y[i] - 2, ++cnt[1]; } ans += abs(cnt[0] - cnt[1]) / 2; sort(x + 1, x + (n << 1) + 1); for (int i = 1; i <= (n << 1); ++i) ans += abs(x[i] - z[i]); printf("%lld", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Incorrect | 2 ms | 380 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Incorrect | 2 ms | 380 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Incorrect | 2 ms | 380 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |