# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
121079 | 2019-06-26T05:10:18 Z | 임유진(#2971) | Coin Collecting (JOI19_ho_t4) | C++14 | 2 ms | 384 KB |
#include<stdio.h> #include<algorithm> using namespace std; #define MAXN 100005 typedef long long lint; typedef pair<lint, lint> pll; pll c[2*MAXN]; int main(){ int N; lint ans=0; scanf("%d", &N); for(int i=0; i<2*N; i++) scanf("%lld%lld", &c[i].first, &c[i].second); sort(c, c+2*N); for(int i=0; i<N; i++) ans+=abs(c[i*2].first-i-1)+abs(min(c[i*2].second, c[i*2+1].second)-1)+abs(c[i*2+1].first-i-1)+abs(max(c[i*2].second, c[i*2+1].second)-2); printf("%lld", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 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 | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Incorrect | 1 ms | 256 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 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 | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Incorrect | 1 ms | 256 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 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 | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Incorrect | 1 ms | 256 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |