# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
121096 | 2019-06-26T06:06:19 Z | 윤지학(#2973) | Coin Collecting (JOI19_ho_t4) | C++14 | 2 ms | 384 KB |
#pragma GCC optimize("O3") #pragma GCC target("arch=skylake") #include <cstdio> int n; int d[100001][2]; int main() { long long s = 0; int i, j, k, l, m, x, y; scanf("%d", &n); for (i = 0; i < n + n; i++) { scanf("%d%d", &x, &y); if (x < 1) { s += 1 - x; x = 1; } if (x > n) { s += x - n; x = n; } if (y < 1) { s += 1 - y; y = 1; } if (y > 2) { s += y - 2; y = 2; } d[x - 1][y - 1]++; } x = y = 0; for (i = 0; i < n; i++) { x += d[i][0] - 1; y += d[i][1] - 1; while (x > 0 && y < 0) { s++; x--; y++; } while (x < 0 && y > 0) { s++; x++; y--; } } printf("%lld\n", s); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Incorrect | 2 ms | 256 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Incorrect | 2 ms | 256 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Incorrect | 2 ms | 256 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |