# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
463679 | 2021-08-11T13:33:53 Z | tomsyd | Highway Tolls (IOI18_highway) | C++17 | 235 ms | 262148 KB |
#include "highway.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> adj; vector<pair<int,int>> edges; void dfs(int node, int prev){ for (int i:adj[node]){ if (i != prev){ dfs(i,node); edges.emplace_back(node,i); } } } void find_pair(int N, vector<int> U, vector<int> V, int A, int B) { int M = U.size(); edges.clear(); adj = vector<vector<int>>(N); map<pair<int,int>,int> id; for (int i=0; i<M; ++i){ adj[U[i]].emplace_back(V[i]); adj[V[i]].emplace_back(U[i]); id[make_pair(U[i],V[i])] = i; id[make_pair(V[i],U[i])] = i; } dfs(0,-1); vector<int> query; for (int i=0; i<M; ++i) query.emplace_back(1); int init = ask(query), crt = 0; for (int j=0; j<edges.size(); ++j){ query[id[edges[j]]] = 0; if (ask(query) != init){ crt = edges[j].second; break; } query[id[edges[j]]] = 1; } answer(crt,0); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 200 KB | Output is correct |
2 | Correct | 1 ms | 200 KB | Output is correct |
3 | Correct | 1 ms | 200 KB | Output is correct |
4 | Correct | 1 ms | 200 KB | Output is correct |
5 | Correct | 2 ms | 200 KB | Output is correct |
6 | Correct | 2 ms | 200 KB | Output is correct |
7 | Correct | 1 ms | 200 KB | Output is correct |
8 | Correct | 2 ms | 200 KB | Output is correct |
9 | Correct | 1 ms | 200 KB | Output is correct |
10 | Correct | 1 ms | 200 KB | Output is correct |
11 | Correct | 2 ms | 200 KB | Output is correct |
12 | Correct | 1 ms | 200 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 456 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 24 ms | 3436 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 456 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 235 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 222 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |