# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
167590 |
2019-12-09T04:17:30 Z |
cgiosy |
None (KOI18_arrowH) |
C++17 |
|
149 ms |
5492 KB |
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<n; i++)
using namespace std;
int main() {
int N;
cin>>N;
vector<vector<int>> A(N);
rep(i, 0, N) {
int x, y;
cin>>x>>y; --y;
A[y].push_back(x);
}
long long s=0;
for(auto&v:A) {
int M=v.size();
sort(begin(v), end(v));
if(M>=2) {
s+=v[1]-v[0]+v[M-1]-v[M-2];
rep(i, 1, M-1) s+=min(v[i]-v[i-1], v[i+1]-v[i]);
}
}
cout<<s;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 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 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
3 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 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 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
3 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
4 ms |
376 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
4 ms |
376 KB |
Output is correct |
12 |
Correct |
4 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
4 ms |
376 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
4 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 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 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
3 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
4 ms |
376 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
4 ms |
376 KB |
Output is correct |
12 |
Correct |
4 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
4 ms |
376 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
4 ms |
376 KB |
Output is correct |
17 |
Correct |
13 ms |
760 KB |
Output is correct |
18 |
Correct |
12 ms |
760 KB |
Output is correct |
19 |
Correct |
12 ms |
760 KB |
Output is correct |
20 |
Correct |
15 ms |
760 KB |
Output is correct |
21 |
Correct |
12 ms |
760 KB |
Output is correct |
22 |
Correct |
12 ms |
632 KB |
Output is correct |
23 |
Correct |
13 ms |
760 KB |
Output is correct |
24 |
Correct |
14 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 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 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
3 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
4 ms |
376 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
4 ms |
376 KB |
Output is correct |
12 |
Correct |
4 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
4 ms |
376 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
4 ms |
376 KB |
Output is correct |
17 |
Correct |
13 ms |
760 KB |
Output is correct |
18 |
Correct |
12 ms |
760 KB |
Output is correct |
19 |
Correct |
12 ms |
760 KB |
Output is correct |
20 |
Correct |
15 ms |
760 KB |
Output is correct |
21 |
Correct |
12 ms |
760 KB |
Output is correct |
22 |
Correct |
12 ms |
632 KB |
Output is correct |
23 |
Correct |
13 ms |
760 KB |
Output is correct |
24 |
Correct |
14 ms |
760 KB |
Output is correct |
25 |
Correct |
147 ms |
5492 KB |
Output is correct |
26 |
Correct |
123 ms |
4344 KB |
Output is correct |
27 |
Correct |
149 ms |
5112 KB |
Output is correct |
28 |
Correct |
121 ms |
4296 KB |
Output is correct |
29 |
Correct |
144 ms |
5112 KB |
Output is correct |
30 |
Correct |
118 ms |
4344 KB |
Output is correct |
31 |
Correct |
132 ms |
4444 KB |
Output is correct |
32 |
Correct |
133 ms |
4964 KB |
Output is correct |