Submission #348470

#TimeUsernameProblemLanguageResultExecution timeMemory
348470juggernautHighway Tolls (IOI18_highway)C++14
5 / 100
15 ms3592 KiB
#include"highway.h" #include<bits/stdc++.h> #ifndef EVAL #include"grader.cpp" #endif using namespace std; vector<pair<int,int>>g[90005]; int id[90005]; bool is[90005]; long long pivot; void dfs(int v,int p,int depth){ if(depth==pivot){ is[v]=1; } for(auto to:g[v])if(to.first!=p){ id[to.first]=to.second; dfs(to.first,v,depth+1); } } void find_pair(int n,vector<int>x,vector<int>y,int a,int b){ vector<int>v(n-1,0); pivot=ask(v)/a; for(int i=0;i+1<n;i++){ g[x[i]].push_back({y[i],i}); g[y[i]].push_back({x[i],i}); } dfs(0,0,0); for(int i=1;i<n;i++) if(is[i]){ v[id[i]]=1; if(ask(v)!=pivot*a){ answer(0,i); return; } v[id[i]]=0; } } /* 5 4 1 2 0 4 0 1 0 2 1 3 1 4 */
#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...