# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82610 | 2018-11-01T00:42:23 Z | chunghan | None (KOI18_arrowH) | C++17 | 5 ms | 3008 KB |
#include<bits/stdc++.h> using namespace std; typedef long long int lld; typedef pair<lld, lld> pll; vector<lld> A[100001]; lld x, y, N; lld rst; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin >> N; for(int i = 0; i < N; i++) { cin >> x >> y; A[y].push_back(x); } for(int i = 1; i < N; i++) { sort(A[i].begin(), A[i].end()); if(A[i].size() <= 1) continue; for(int j = 0; j < A[i].size(); j++) { lld tmp = 2e9; if(j != 0) tmp = min(tmp, A[i][j]-A[i][j-1]); if(j != A[i].size()-1) tmp = min(tmp, A[i][j+1]-A[i][j]); rst += tmp; } } cout << rst; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 4 ms | 2816 KB | Output is correct |
3 | Correct | 4 ms | 2912 KB | Output is correct |
4 | Correct | 5 ms | 2912 KB | Output is correct |
5 | Correct | 4 ms | 2936 KB | Output is correct |
6 | Correct | 5 ms | 2940 KB | Output is correct |
7 | Incorrect | 4 ms | 3008 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 4 ms | 2816 KB | Output is correct |
3 | Correct | 4 ms | 2912 KB | Output is correct |
4 | Correct | 5 ms | 2912 KB | Output is correct |
5 | Correct | 4 ms | 2936 KB | Output is correct |
6 | Correct | 5 ms | 2940 KB | Output is correct |
7 | Incorrect | 4 ms | 3008 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 4 ms | 2816 KB | Output is correct |
3 | Correct | 4 ms | 2912 KB | Output is correct |
4 | Correct | 5 ms | 2912 KB | Output is correct |
5 | Correct | 4 ms | 2936 KB | Output is correct |
6 | Correct | 5 ms | 2940 KB | Output is correct |
7 | Incorrect | 4 ms | 3008 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2680 KB | Output is correct |
2 | Correct | 4 ms | 2816 KB | Output is correct |
3 | Correct | 4 ms | 2912 KB | Output is correct |
4 | Correct | 5 ms | 2912 KB | Output is correct |
5 | Correct | 4 ms | 2936 KB | Output is correct |
6 | Correct | 5 ms | 2940 KB | Output is correct |
7 | Incorrect | 4 ms | 3008 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |