# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
733863 | 2023-05-01T11:19:58 Z | vjudge1 | City Mapping (NOI18_citymapping) | C++17 | 120 ms | 8776 KB |
#include "citymapping.h" #include <bits/stdc++.h> using namespace std; using ll = long long; void find_roads(int N, int Q, int A[], int B[], int W[]) { vector<tuple<ll, int, int>> T; for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { T.emplace_back(get_distance(i + 1, j + 1), i, j); } } sort(T.begin(), T.end()); vector<int> par(N); iota(par.begin(), par.end(), 0); function<int(int)> find = [&](int x) { return x == par[x] ? x : par[x] = find(par[x]); }; int p = 0; for (int i = 0; i < T.size(); i++) { auto [z, x, y] = T[i]; if (find(x) != find(y)) { A[p] = x + 1; B[p] = y + 1; W[p] = z; p++; par[find(x)] = find(y); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 112 ms | 8760 KB | Correct: 498501 out of 500000 queries used. |
2 | Correct | 105 ms | 8768 KB | Correct: 499500 out of 500000 queries used. |
3 | Correct | 103 ms | 8768 KB | Correct: 492528 out of 500000 queries used. |
4 | Correct | 95 ms | 8764 KB | Correct: 494515 out of 500000 queries used. |
5 | Correct | 120 ms | 8764 KB | Correct: 498501 out of 500000 queries used. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 112 ms | 8760 KB | Correct: 498501 out of 500000 queries used. |
2 | Correct | 105 ms | 8768 KB | Correct: 499500 out of 500000 queries used. |
3 | Correct | 103 ms | 8768 KB | Correct: 492528 out of 500000 queries used. |
4 | Correct | 95 ms | 8764 KB | Correct: 494515 out of 500000 queries used. |
5 | Correct | 120 ms | 8764 KB | Correct: 498501 out of 500000 queries used. |
6 | Correct | 92 ms | 8740 KB | Correct: 495510 out of 500000 queries used. |
7 | Correct | 96 ms | 8760 KB | Correct: 497503 out of 500000 queries used. |
8 | Correct | 85 ms | 8776 KB | Correct: 497503 out of 500000 queries used. |
9 | Correct | 82 ms | 8704 KB | Correct: 495510 out of 500000 queries used. |
10 | Correct | 95 ms | 8760 KB | Correct: 496506 out of 500000 queries used. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 852 KB | Too many calls to get_distance(). |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 852 KB | Too many calls to get_distance(). |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 112 ms | 8760 KB | Correct: 498501 out of 500000 queries used. |
2 | Correct | 105 ms | 8768 KB | Correct: 499500 out of 500000 queries used. |
3 | Correct | 103 ms | 8768 KB | Correct: 492528 out of 500000 queries used. |
4 | Correct | 95 ms | 8764 KB | Correct: 494515 out of 500000 queries used. |
5 | Correct | 120 ms | 8764 KB | Correct: 498501 out of 500000 queries used. |
6 | Correct | 92 ms | 8740 KB | Correct: 495510 out of 500000 queries used. |
7 | Correct | 96 ms | 8760 KB | Correct: 497503 out of 500000 queries used. |
8 | Correct | 85 ms | 8776 KB | Correct: 497503 out of 500000 queries used. |
9 | Correct | 82 ms | 8704 KB | Correct: 495510 out of 500000 queries used. |
10 | Correct | 95 ms | 8760 KB | Correct: 496506 out of 500000 queries used. |
11 | Incorrect | 2 ms | 852 KB | Too many calls to get_distance(). |
12 | Halted | 0 ms | 0 KB | - |