# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
140431 | 2019-08-02T21:58:57 Z | arthurconmy | Highway Tolls (IOI18_highway) | C++14 | 38 ms | 780 KB |
#include <bits/stdc++.h> #ifndef ARTHUR_LOCAL #include "highway.h" #endif using namespace std; using ll = long long; const int MAXN = 100; int parent[MAXN]; int par_edge[100]; vector<pair<int,int>> adj[100]; void dfs(int v) { for(auto u:adj[v]) { if(parent[u.first]!=-1) continue; parent[u.first]=v; par_edge[u.first]=u.second; dfs(u.first); } } void find_pair(int n, vector<int> U, vector<int> V, int A, int B) { for(int i=0; i<n; i++) parent[i]=-1; for(int i=0; i<n-1; i++) { adj[U[i]].push_back({V[i],i}); adj[V[i]].push_back({U[i],i}); } dfs(0); vector<int> askin(n-1); ll base = ask(askin); vector<ll> anss(n); ll max_cur=0; for(int i=1; i<n; i++) { for(int j=0; j<n-1; j++) askin[j]=0; int i_copy = i; while(i_copy != 0) { askin[par_edge[i_copy]]=1; i_copy=parent[i_copy]; } ll cur = ask(askin); anss[i]=cur; max_cur=max(max_cur,cur); } for(int i=0; i<n; i++) { if(anss[i]==max_cur && anss[parent[i]]!=max_cur) answer(0,i); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 248 KB | Output is correct |
3 | Correct | 3 ms | 248 KB | Output is correct |
4 | Correct | 3 ms | 248 KB | Output is correct |
5 | Correct | 3 ms | 248 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 296 KB | Output is correct |
8 | Correct | 3 ms | 248 KB | Output is correct |
9 | Correct | 3 ms | 248 KB | Output is correct |
10 | Correct | 3 ms | 248 KB | Output is correct |
11 | Correct | 3 ms | 248 KB | Output is correct |
12 | Correct | 4 ms | 248 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 38 ms | 776 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 14 ms | 780 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 19 ms | 760 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |