# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
836233 | 2023-08-24T09:00:06 Z | unnick | City Mapping (NOI18_citymapping) | C++14 | 2 ms | 516 KB |
#include "citymapping.h" #include <algorithm> #include <numeric> #include <vector> using namespace std; #define ll long long void find_roads(int N, int Q, int A[], int B[], int W[]) { int start; { ll maxd = 0; for (int i = 2; i <= N; i++) { ll d = get_distance(1, i); if (d > maxd) { maxd = d; start = i; } } } vector<ll> dists(N); dists[start-1] = 0; vector<int> ids(N); iota(ids.begin(), ids.end(), 0); for (int i = 1; i <= N; i++) { if (i == start) continue; dists[i-1] = get_distance(start,i); } sort(ids.begin(), ids.end(), [&](int a, int b) { return dists[a] < dists[b]; }); for (int i = 0; i < N-1; i++) { A[i] = ids[i]+1; B[i] = ids[i+1]+1; W[i] = dists[ids[i+1]] - dists[ids[i]]; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 468 KB | Correct: 1996 out of 500000 queries used. |
2 | Incorrect | 1 ms | 468 KB | Reported list of edges differ from actual. |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 468 KB | Correct: 1996 out of 500000 queries used. |
2 | Incorrect | 1 ms | 468 KB | Reported list of edges differ from actual. |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 468 KB | Correct: 1980 out of 12000 queries used. |
2 | Correct | 1 ms | 468 KB | Correct: 1984 out of 12000 queries used. |
3 | Correct | 1 ms | 468 KB | Correct: 1998 out of 12000 queries used. |
4 | Correct | 1 ms | 468 KB | Correct: 1984 out of 12000 queries used. |
5 | Correct | 1 ms | 468 KB | Correct: 1980 out of 12000 queries used. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 468 KB | Correct: 1980 out of 12000 queries used. |
2 | Correct | 1 ms | 468 KB | Correct: 1984 out of 12000 queries used. |
3 | Correct | 1 ms | 468 KB | Correct: 1998 out of 12000 queries used. |
4 | Correct | 1 ms | 468 KB | Correct: 1984 out of 12000 queries used. |
5 | Correct | 1 ms | 468 KB | Correct: 1980 out of 12000 queries used. |
6 | Correct | 2 ms | 516 KB | Correct: 1994 out of 12000 queries used. |
7 | Correct | 2 ms | 468 KB | Correct: 1990 out of 12000 queries used. |
8 | Correct | 2 ms | 468 KB | Correct: 1998 out of 12000 queries used. |
9 | Correct | 1 ms | 468 KB | Correct: 1992 out of 12000 queries used. |
10 | Correct | 1 ms | 468 KB | Correct: 1986 out of 12000 queries used. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 468 KB | Correct: 1996 out of 500000 queries used. |
2 | Incorrect | 1 ms | 468 KB | Reported list of edges differ from actual. |
3 | Halted | 0 ms | 0 KB | - |