# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
121081 | 2019-06-26T05:14:58 Z | 김세빈(#2968) | Coin Collecting (JOI19_ho_t4) | C++14 | 2 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll D[101010]; ll n, s, ans; int main() { ll i, x, y; scanf("%lld", &n); for(i=0; i<n+n; i++){ scanf("%lld%lld", &x, &y); if(x < 1) ans += 1 - x, x = 1; if(x > n) ans += x - n, x = n; if(y < 1) ans += 1 - y, y = 1; if(y > 2) ans += y - 2, y = 2; D[x] ++; if(y == 1) s ++; } for(i=1; i<=n; i++){ D[i] += D[i - 1]; ans += abs(2 * i - D[i]); } printf("%lld\n", ans + abs(n - s)); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Incorrect | 2 ms | 256 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Incorrect | 2 ms | 256 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Incorrect | 2 ms | 256 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |