# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
98844 | 2019-02-26T14:03:10 Z | bogdan10bos | Coin Collecting (JOI19_ho_t4) | C++14 | 2 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; //#define FILE_IO typedef long long LL; int N; int cnt[100005][3]; int main() { #ifdef FILE_IO freopen("1.in", "r", stdin); freopen("1.out", "w", stdout); #endif LL ans = 0; scanf("%d", &N); for(int i = 1; i <= 2 * N; i++) { int x, y, nx, ny; scanf("%d%d", &x, &y); if(y <= 1) ny = 1; else ny = 2; if(1 <= x && x <= N) nx = x; else if(x < 1) nx = 1; else nx = N; cnt[nx][ny]++; ans += 1LL * abs(nx - x) + 1LL * abs(ny - y); } int lst = 0, up = 0, down = 0; for(int i = 1; i <= N; i++) { lst += cnt[i][1] + cnt[i][2]; up += cnt[i][2]; down += cnt[i][1]; ans += abs(lst - (2 * i)); } ans += abs(up - N); printf("%lld\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 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 | 384 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 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 | 384 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 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 | 384 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |