Submission #427411

#TimeUsernameProblemLanguageResultExecution timeMemory
427411MonchitoHighway Tolls (IOI18_highway)C++14
5 / 100
128 ms7576 KiB
#include "highway.h" using namespace std; #define sz(x) (int)x.size() const int MAXN = 9e4; int M; vector<pair<int,int>> G[MAXN]; bool vis[MAXN]; vector<int> p; long long cost; void DFS(int u, int& ans) { vis[u] = true; for(pair<int,int> v : G[u]) { if(!vis[v.first]) { p[v.second] = 1; if(ask(p) > cost) { p[v.second] = 0; DFS(v.first, ans); return; } } } ans = u; } void find_pair(int N, vector<int> U, vector<int> V, int A, int B) { M = sz(U); p = vector<int>(M, 0); cost = ask(p); for(int i=0; i<M; i++) { G[U[i]].push_back({V[i], i}); G[V[i]].push_back({U[i], i}); } int ans=-1; DFS(0, ans); answer(0, ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...