# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
269476 | 2020-08-17T07:17:42 Z | sean9892 | None (KOI18_arrowH) | C++14 | 117 ms | 7612 KB |
#include<bits/stdc++.h> using namespace std; vector<int> v[100010]; set<int> s; int main(void){ ios::sync_with_stdio(0);cin.tie(0); int n; cin>>n; for(int i=0;i<n;i++){ int x,y; cin>>x>>y; v[y].push_back(x); s.insert(y); } long long sum=0; for(int c:s){ sort(v[c].begin(),v[c].end()); if(v[c].size()==1)continue; auto& w=v[c]; sum+=1ll*w[1]-w[0]+w[w.size()-1]-w[w.size()-2]; for(int i=1;i<w.size()-1;i++){ sum+=min(w[i]-w[i-1],w[i+1]-w[i]); } } cout<<sum; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 3 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2688 KB | Output is correct |
5 | Correct | 3 ms | 2688 KB | Output is correct |
6 | Correct | 2 ms | 2688 KB | Output is correct |
7 | Correct | 2 ms | 2688 KB | Output is correct |
8 | Correct | 2 ms | 2688 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 3 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2688 KB | Output is correct |
5 | Correct | 3 ms | 2688 KB | Output is correct |
6 | Correct | 2 ms | 2688 KB | Output is correct |
7 | Correct | 2 ms | 2688 KB | Output is correct |
8 | Correct | 2 ms | 2688 KB | Output is correct |
9 | Correct | 3 ms | 2688 KB | Output is correct |
10 | Correct | 3 ms | 2688 KB | Output is correct |
11 | Correct | 3 ms | 2688 KB | Output is correct |
12 | Correct | 3 ms | 2688 KB | Output is correct |
13 | Correct | 4 ms | 2688 KB | Output is correct |
14 | Correct | 5 ms | 2688 KB | Output is correct |
15 | Correct | 3 ms | 2688 KB | Output is correct |
16 | Correct | 3 ms | 2784 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 3 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2688 KB | Output is correct |
5 | Correct | 3 ms | 2688 KB | Output is correct |
6 | Correct | 2 ms | 2688 KB | Output is correct |
7 | Correct | 2 ms | 2688 KB | Output is correct |
8 | Correct | 2 ms | 2688 KB | Output is correct |
9 | Correct | 3 ms | 2688 KB | Output is correct |
10 | Correct | 3 ms | 2688 KB | Output is correct |
11 | Correct | 3 ms | 2688 KB | Output is correct |
12 | Correct | 3 ms | 2688 KB | Output is correct |
13 | Correct | 4 ms | 2688 KB | Output is correct |
14 | Correct | 5 ms | 2688 KB | Output is correct |
15 | Correct | 3 ms | 2688 KB | Output is correct |
16 | Correct | 3 ms | 2784 KB | Output is correct |
17 | Correct | 8 ms | 3072 KB | Output is correct |
18 | Correct | 10 ms | 3072 KB | Output is correct |
19 | Correct | 8 ms | 2944 KB | Output is correct |
20 | Correct | 7 ms | 3072 KB | Output is correct |
21 | Correct | 7 ms | 2880 KB | Output is correct |
22 | Correct | 5 ms | 2944 KB | Output is correct |
23 | Correct | 7 ms | 3072 KB | Output is correct |
24 | Correct | 9 ms | 3048 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 3 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2688 KB | Output is correct |
5 | Correct | 3 ms | 2688 KB | Output is correct |
6 | Correct | 2 ms | 2688 KB | Output is correct |
7 | Correct | 2 ms | 2688 KB | Output is correct |
8 | Correct | 2 ms | 2688 KB | Output is correct |
9 | Correct | 3 ms | 2688 KB | Output is correct |
10 | Correct | 3 ms | 2688 KB | Output is correct |
11 | Correct | 3 ms | 2688 KB | Output is correct |
12 | Correct | 3 ms | 2688 KB | Output is correct |
13 | Correct | 4 ms | 2688 KB | Output is correct |
14 | Correct | 5 ms | 2688 KB | Output is correct |
15 | Correct | 3 ms | 2688 KB | Output is correct |
16 | Correct | 3 ms | 2784 KB | Output is correct |
17 | Correct | 8 ms | 3072 KB | Output is correct |
18 | Correct | 10 ms | 3072 KB | Output is correct |
19 | Correct | 8 ms | 2944 KB | Output is correct |
20 | Correct | 7 ms | 3072 KB | Output is correct |
21 | Correct | 7 ms | 2880 KB | Output is correct |
22 | Correct | 5 ms | 2944 KB | Output is correct |
23 | Correct | 7 ms | 3072 KB | Output is correct |
24 | Correct | 9 ms | 3048 KB | Output is correct |
25 | Correct | 111 ms | 7612 KB | Output is correct |
26 | Correct | 39 ms | 4856 KB | Output is correct |
27 | Correct | 76 ms | 6136 KB | Output is correct |
28 | Correct | 54 ms | 4948 KB | Output is correct |
29 | Correct | 73 ms | 5624 KB | Output is correct |
30 | Correct | 70 ms | 5332 KB | Output is correct |
31 | Correct | 53 ms | 4856 KB | Output is correct |
32 | Correct | 117 ms | 6984 KB | Output is correct |