# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101465 | 2019-03-19T02:46:27 Z | cheeheng | Adriatic (CEOI13_adriatic) | C++14 | 2000 ms | 231916 KB |
#include <bits/stdc++.h> using namespace std; int R[250000]; int C[250000]; int dist[250000]; vector<int> AdjList[250005]; int main(){ int N; scanf("%d", &N); for(int i = 0; i < N; i ++){ scanf("%d%d", &R[i], &C[i]); } for(int i = 0; i < N; i ++){ for(int j = i+1; j < N; j ++){ if((R[i] < R[j] && C[i] < C[j]) || (R[i] > R[j] && C[i] > C[j])){ AdjList[i].push_back(j); AdjList[j].push_back(i); } } } for(int i = 0; i < N; i ++){ long long ans = 0; memset(dist, -1, sizeof(dist)); queue<int> q; q.push(i); dist[i] = 0; while(!q.empty()){ int u = q.front(); q.pop(); for(int v: AdjList[u]){ if(dist[v] == -1){ dist[v] = dist[u] + 1; q.push(v); } } } for(int j = 0; j < N; j ++){ ans += dist[j]; } printf("%lld\n", ans); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 7140 KB | Output is correct |
2 | Correct | 15 ms | 7296 KB | Output is correct |
3 | Correct | 13 ms | 7168 KB | Output is correct |
4 | Correct | 14 ms | 7268 KB | Output is correct |
5 | Correct | 13 ms | 7168 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 413 ms | 7940 KB | Output is correct |
2 | Execution timed out | 2047 ms | 14140 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2011 ms | 12016 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2062 ms | 231916 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2052 ms | 130048 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |