# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
152120 | 2019-09-06T14:40:26 Z | gs18103 | None (KOI18_arrowH) | C++14 | 50 ms | 5576 KB |
#include <bits/stdc++.h> #define fi first #define se second #define all(v) v.begin(), v.end() #define eb emplace_back #define INF 1e9 #define LINF 1e18 #define g(tp, x) get<x>(tp) using namespace std; vector <int> arr[101010]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; for(int i = 1; i <= n; i++) { int x, y; cin >> x >> y; arr[y].eb(x); } long long ans = 0; for(int i = 1; i <= n; i++) { sort(all(arr[i])); for(int j = 0; j < arr[i].size(); j++) { int temp = INF; if(j) temp = min(temp, arr[i][j]-arr[i][j-1]); if(j+1<arr[i].size()) temp = min(temp, arr[i][j+1]-arr[i][j]); if(temp != INF) ans += temp; } } cout << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 4 ms | 2680 KB | Output is correct |
3 | Correct | 4 ms | 2680 KB | Output is correct |
4 | Correct | 4 ms | 2680 KB | Output is correct |
5 | Correct | 4 ms | 2680 KB | Output is correct |
6 | Correct | 4 ms | 2680 KB | Output is correct |
7 | Correct | 4 ms | 2680 KB | Output is correct |
8 | Correct | 5 ms | 2680 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 4 ms | 2680 KB | Output is correct |
3 | Correct | 4 ms | 2680 KB | Output is correct |
4 | Correct | 4 ms | 2680 KB | Output is correct |
5 | Correct | 4 ms | 2680 KB | Output is correct |
6 | Correct | 4 ms | 2680 KB | Output is correct |
7 | Correct | 4 ms | 2680 KB | Output is correct |
8 | Correct | 5 ms | 2680 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 4 ms | 2808 KB | Output is correct |
11 | Correct | 5 ms | 2808 KB | Output is correct |
12 | Correct | 5 ms | 2680 KB | Output is correct |
13 | Correct | 5 ms | 2808 KB | Output is correct |
14 | Correct | 5 ms | 2684 KB | Output is correct |
15 | Correct | 5 ms | 2680 KB | Output is correct |
16 | Correct | 5 ms | 2808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 4 ms | 2680 KB | Output is correct |
3 | Correct | 4 ms | 2680 KB | Output is correct |
4 | Correct | 4 ms | 2680 KB | Output is correct |
5 | Correct | 4 ms | 2680 KB | Output is correct |
6 | Correct | 4 ms | 2680 KB | Output is correct |
7 | Correct | 4 ms | 2680 KB | Output is correct |
8 | Correct | 5 ms | 2680 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 4 ms | 2808 KB | Output is correct |
11 | Correct | 5 ms | 2808 KB | Output is correct |
12 | Correct | 5 ms | 2680 KB | Output is correct |
13 | Correct | 5 ms | 2808 KB | Output is correct |
14 | Correct | 5 ms | 2684 KB | Output is correct |
15 | Correct | 5 ms | 2680 KB | Output is correct |
16 | Correct | 5 ms | 2808 KB | Output is correct |
17 | Correct | 7 ms | 2936 KB | Output is correct |
18 | Correct | 7 ms | 2936 KB | Output is correct |
19 | Correct | 7 ms | 2908 KB | Output is correct |
20 | Correct | 8 ms | 2936 KB | Output is correct |
21 | Correct | 8 ms | 2936 KB | Output is correct |
22 | Correct | 8 ms | 2936 KB | Output is correct |
23 | Correct | 8 ms | 2936 KB | Output is correct |
24 | Correct | 7 ms | 2936 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 4 ms | 2680 KB | Output is correct |
3 | Correct | 4 ms | 2680 KB | Output is correct |
4 | Correct | 4 ms | 2680 KB | Output is correct |
5 | Correct | 4 ms | 2680 KB | Output is correct |
6 | Correct | 4 ms | 2680 KB | Output is correct |
7 | Correct | 4 ms | 2680 KB | Output is correct |
8 | Correct | 5 ms | 2680 KB | Output is correct |
9 | Correct | 4 ms | 2680 KB | Output is correct |
10 | Correct | 4 ms | 2808 KB | Output is correct |
11 | Correct | 5 ms | 2808 KB | Output is correct |
12 | Correct | 5 ms | 2680 KB | Output is correct |
13 | Correct | 5 ms | 2808 KB | Output is correct |
14 | Correct | 5 ms | 2684 KB | Output is correct |
15 | Correct | 5 ms | 2680 KB | Output is correct |
16 | Correct | 5 ms | 2808 KB | Output is correct |
17 | Correct | 7 ms | 2936 KB | Output is correct |
18 | Correct | 7 ms | 2936 KB | Output is correct |
19 | Correct | 7 ms | 2908 KB | Output is correct |
20 | Correct | 8 ms | 2936 KB | Output is correct |
21 | Correct | 8 ms | 2936 KB | Output is correct |
22 | Correct | 8 ms | 2936 KB | Output is correct |
23 | Correct | 8 ms | 2936 KB | Output is correct |
24 | Correct | 7 ms | 2936 KB | Output is correct |
25 | Correct | 49 ms | 5576 KB | Output is correct |
26 | Correct | 38 ms | 4700 KB | Output is correct |
27 | Correct | 50 ms | 5116 KB | Output is correct |
28 | Correct | 35 ms | 4600 KB | Output is correct |
29 | Correct | 45 ms | 5184 KB | Output is correct |
30 | Correct | 34 ms | 4728 KB | Output is correct |
31 | Correct | 34 ms | 4728 KB | Output is correct |
32 | Correct | 43 ms | 5240 KB | Output is correct |