# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
209725 |
2020-03-15T12:37:26 Z |
gratus907 |
None (KOI18_arrowH) |
C++17 |
|
52 ms |
6008 KB |
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define ll long long
#define eps 1e-7
#define all(x) ((x).begin()),((x).end())
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
using pii = pair<int, int>;
#define int ll
vector <int> points[101010];
int n;
int32_t main()
{
usecppio
cin >> n;
for (int i = 0; i<n; i++)
{
int x, y;
cin >> x >> y;
points[y].push_back(x);
}
int ans = 0;
for (int i = 0; i<101010; i++)
{
int s = points[i].size();
if (s<=1)
continue;
else
{
sort(all(points[i]));
for (int j = 1; j<s-1; j++)
{
ans += (min(points[i][j]-points[i][j-1],points[i][j+1]-points[i][j]));
}
ans += points[i][1]-points[i][0];
ans += points[i][s-1]-points[i][s-2];
}
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
2552 KB |
Output is correct |
2 |
Correct |
6 ms |
2680 KB |
Output is correct |
3 |
Correct |
7 ms |
2680 KB |
Output is correct |
4 |
Correct |
6 ms |
2680 KB |
Output is correct |
5 |
Correct |
6 ms |
2680 KB |
Output is correct |
6 |
Correct |
7 ms |
2680 KB |
Output is correct |
7 |
Correct |
7 ms |
2680 KB |
Output is correct |
8 |
Correct |
7 ms |
2728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
2552 KB |
Output is correct |
2 |
Correct |
6 ms |
2680 KB |
Output is correct |
3 |
Correct |
7 ms |
2680 KB |
Output is correct |
4 |
Correct |
6 ms |
2680 KB |
Output is correct |
5 |
Correct |
6 ms |
2680 KB |
Output is correct |
6 |
Correct |
7 ms |
2680 KB |
Output is correct |
7 |
Correct |
7 ms |
2680 KB |
Output is correct |
8 |
Correct |
7 ms |
2728 KB |
Output is correct |
9 |
Correct |
7 ms |
2680 KB |
Output is correct |
10 |
Correct |
6 ms |
2680 KB |
Output is correct |
11 |
Correct |
7 ms |
2808 KB |
Output is correct |
12 |
Correct |
7 ms |
2680 KB |
Output is correct |
13 |
Correct |
7 ms |
2808 KB |
Output is correct |
14 |
Correct |
7 ms |
2680 KB |
Output is correct |
15 |
Correct |
7 ms |
2808 KB |
Output is correct |
16 |
Correct |
7 ms |
2680 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
2552 KB |
Output is correct |
2 |
Correct |
6 ms |
2680 KB |
Output is correct |
3 |
Correct |
7 ms |
2680 KB |
Output is correct |
4 |
Correct |
6 ms |
2680 KB |
Output is correct |
5 |
Correct |
6 ms |
2680 KB |
Output is correct |
6 |
Correct |
7 ms |
2680 KB |
Output is correct |
7 |
Correct |
7 ms |
2680 KB |
Output is correct |
8 |
Correct |
7 ms |
2728 KB |
Output is correct |
9 |
Correct |
7 ms |
2680 KB |
Output is correct |
10 |
Correct |
6 ms |
2680 KB |
Output is correct |
11 |
Correct |
7 ms |
2808 KB |
Output is correct |
12 |
Correct |
7 ms |
2680 KB |
Output is correct |
13 |
Correct |
7 ms |
2808 KB |
Output is correct |
14 |
Correct |
7 ms |
2680 KB |
Output is correct |
15 |
Correct |
7 ms |
2808 KB |
Output is correct |
16 |
Correct |
7 ms |
2680 KB |
Output is correct |
17 |
Correct |
9 ms |
2936 KB |
Output is correct |
18 |
Correct |
9 ms |
2936 KB |
Output is correct |
19 |
Correct |
9 ms |
2936 KB |
Output is correct |
20 |
Correct |
10 ms |
3064 KB |
Output is correct |
21 |
Correct |
9 ms |
2940 KB |
Output is correct |
22 |
Correct |
8 ms |
2936 KB |
Output is correct |
23 |
Correct |
9 ms |
2936 KB |
Output is correct |
24 |
Correct |
10 ms |
2936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
2552 KB |
Output is correct |
2 |
Correct |
6 ms |
2680 KB |
Output is correct |
3 |
Correct |
7 ms |
2680 KB |
Output is correct |
4 |
Correct |
6 ms |
2680 KB |
Output is correct |
5 |
Correct |
6 ms |
2680 KB |
Output is correct |
6 |
Correct |
7 ms |
2680 KB |
Output is correct |
7 |
Correct |
7 ms |
2680 KB |
Output is correct |
8 |
Correct |
7 ms |
2728 KB |
Output is correct |
9 |
Correct |
7 ms |
2680 KB |
Output is correct |
10 |
Correct |
6 ms |
2680 KB |
Output is correct |
11 |
Correct |
7 ms |
2808 KB |
Output is correct |
12 |
Correct |
7 ms |
2680 KB |
Output is correct |
13 |
Correct |
7 ms |
2808 KB |
Output is correct |
14 |
Correct |
7 ms |
2680 KB |
Output is correct |
15 |
Correct |
7 ms |
2808 KB |
Output is correct |
16 |
Correct |
7 ms |
2680 KB |
Output is correct |
17 |
Correct |
9 ms |
2936 KB |
Output is correct |
18 |
Correct |
9 ms |
2936 KB |
Output is correct |
19 |
Correct |
9 ms |
2936 KB |
Output is correct |
20 |
Correct |
10 ms |
3064 KB |
Output is correct |
21 |
Correct |
9 ms |
2940 KB |
Output is correct |
22 |
Correct |
8 ms |
2936 KB |
Output is correct |
23 |
Correct |
9 ms |
2936 KB |
Output is correct |
24 |
Correct |
10 ms |
2936 KB |
Output is correct |
25 |
Correct |
52 ms |
6008 KB |
Output is correct |
26 |
Correct |
36 ms |
5240 KB |
Output is correct |
27 |
Correct |
47 ms |
5592 KB |
Output is correct |
28 |
Correct |
38 ms |
5240 KB |
Output is correct |
29 |
Correct |
43 ms |
5624 KB |
Output is correct |
30 |
Correct |
38 ms |
5112 KB |
Output is correct |
31 |
Correct |
44 ms |
5240 KB |
Output is correct |
32 |
Correct |
49 ms |
5624 KB |
Output is correct |