# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
63151 | 2018-08-01T01:15:26 Z | khsoo01 | None (KOI18_arrowH) | C++11 | 72 ms | 16632 KB |
#include<bits/stdc++.h> using namespace std; const int N = 100005, inf = 2e9; int n; long long ans; vector<int> v[N]; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) { int A, B; scanf("%d%d",&A,&B); v[B].push_back(A); } for(int i=1;i<=n;i++) { sort(v[i].begin(), v[i].end()); if(v[i].size() == 1) continue; for(int j=0;j<(int)v[i].size();j++) { int T = inf; if(j != 0) T = min(T, v[i][j] - v[i][j-1]); if(j != (int)v[i].size() - 1) T = min(T, v[i][j+1] - v[i][j]); ans += T; } } printf("%lld\n",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 5 ms | 2716 KB | Output is correct |
3 | Correct | 6 ms | 2872 KB | Output is correct |
4 | Correct | 6 ms | 2872 KB | Output is correct |
5 | Correct | 5 ms | 2872 KB | Output is correct |
6 | Correct | 6 ms | 3068 KB | Output is correct |
7 | Correct | 5 ms | 3068 KB | Output is correct |
8 | Correct | 5 ms | 3120 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 5 ms | 2716 KB | Output is correct |
3 | Correct | 6 ms | 2872 KB | Output is correct |
4 | Correct | 6 ms | 2872 KB | Output is correct |
5 | Correct | 5 ms | 2872 KB | Output is correct |
6 | Correct | 6 ms | 3068 KB | Output is correct |
7 | Correct | 5 ms | 3068 KB | Output is correct |
8 | Correct | 5 ms | 3120 KB | Output is correct |
9 | Correct | 6 ms | 3120 KB | Output is correct |
10 | Correct | 6 ms | 3120 KB | Output is correct |
11 | Correct | 5 ms | 3120 KB | Output is correct |
12 | Correct | 5 ms | 3120 KB | Output is correct |
13 | Correct | 6 ms | 3120 KB | Output is correct |
14 | Correct | 6 ms | 3120 KB | Output is correct |
15 | Correct | 5 ms | 3160 KB | Output is correct |
16 | Correct | 6 ms | 3160 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 5 ms | 2716 KB | Output is correct |
3 | Correct | 6 ms | 2872 KB | Output is correct |
4 | Correct | 6 ms | 2872 KB | Output is correct |
5 | Correct | 5 ms | 2872 KB | Output is correct |
6 | Correct | 6 ms | 3068 KB | Output is correct |
7 | Correct | 5 ms | 3068 KB | Output is correct |
8 | Correct | 5 ms | 3120 KB | Output is correct |
9 | Correct | 6 ms | 3120 KB | Output is correct |
10 | Correct | 6 ms | 3120 KB | Output is correct |
11 | Correct | 5 ms | 3120 KB | Output is correct |
12 | Correct | 5 ms | 3120 KB | Output is correct |
13 | Correct | 6 ms | 3120 KB | Output is correct |
14 | Correct | 6 ms | 3120 KB | Output is correct |
15 | Correct | 5 ms | 3160 KB | Output is correct |
16 | Correct | 6 ms | 3160 KB | Output is correct |
17 | Correct | 10 ms | 3288 KB | Output is correct |
18 | Correct | 9 ms | 3540 KB | Output is correct |
19 | Correct | 9 ms | 3540 KB | Output is correct |
20 | Correct | 10 ms | 3764 KB | Output is correct |
21 | Correct | 11 ms | 3780 KB | Output is correct |
22 | Correct | 8 ms | 3888 KB | Output is correct |
23 | Correct | 9 ms | 4128 KB | Output is correct |
24 | Correct | 12 ms | 4256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 5 ms | 2716 KB | Output is correct |
3 | Correct | 6 ms | 2872 KB | Output is correct |
4 | Correct | 6 ms | 2872 KB | Output is correct |
5 | Correct | 5 ms | 2872 KB | Output is correct |
6 | Correct | 6 ms | 3068 KB | Output is correct |
7 | Correct | 5 ms | 3068 KB | Output is correct |
8 | Correct | 5 ms | 3120 KB | Output is correct |
9 | Correct | 6 ms | 3120 KB | Output is correct |
10 | Correct | 6 ms | 3120 KB | Output is correct |
11 | Correct | 5 ms | 3120 KB | Output is correct |
12 | Correct | 5 ms | 3120 KB | Output is correct |
13 | Correct | 6 ms | 3120 KB | Output is correct |
14 | Correct | 6 ms | 3120 KB | Output is correct |
15 | Correct | 5 ms | 3160 KB | Output is correct |
16 | Correct | 6 ms | 3160 KB | Output is correct |
17 | Correct | 10 ms | 3288 KB | Output is correct |
18 | Correct | 9 ms | 3540 KB | Output is correct |
19 | Correct | 9 ms | 3540 KB | Output is correct |
20 | Correct | 10 ms | 3764 KB | Output is correct |
21 | Correct | 11 ms | 3780 KB | Output is correct |
22 | Correct | 8 ms | 3888 KB | Output is correct |
23 | Correct | 9 ms | 4128 KB | Output is correct |
24 | Correct | 12 ms | 4256 KB | Output is correct |
25 | Correct | 72 ms | 6940 KB | Output is correct |
26 | Correct | 47 ms | 7576 KB | Output is correct |
27 | Correct | 66 ms | 9436 KB | Output is correct |
28 | Correct | 53 ms | 10532 KB | Output is correct |
29 | Correct | 61 ms | 12100 KB | Output is correct |
30 | Correct | 54 ms | 13228 KB | Output is correct |
31 | Correct | 49 ms | 14468 KB | Output is correct |
32 | Correct | 61 ms | 16632 KB | Output is correct |