제출 #139385

#제출 시각아이디문제언어결과실행 시간메모리
139385wilwxk통행료 (IOI18_highway)C++14
5 / 100
522 ms262148 KiB
#include "highway.h" #include <bits/stdc++.h> using namespace std; const int MAXN=9e4+5; vector<int> g[MAXN], config; vector<int> bons; int aresta[MAXN*2][2]; int pid[MAXN], lvl[MAXN]; int n, m, x, y, tam; void dfs(int cur, int pp, int d) { //printf("%d %d %d\n", cur, pp, d); pid[cur]=pp; lvl[cur]=d; for(auto vid : g[cur]) { if(vid==pp) continue; int viz= aresta[vid][ aresta[vid][0]==cur ]; dfs(viz, vid, d+1); } } void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) { n=N; m=U.size(); x=A; y=B; for(int i=0; i<m; i++) { int a=U[i]; int b=V[i]; aresta[i][0]=a; aresta[i][1]=b; g[a].push_back(i); g[b].push_back(i); config.push_back(0); } dfs(0, -1, 0); tam=ask(config); tam/=x; for(int i=0; i<n; i++) if(lvl[i]==tam) bons.push_back(i); srand(0); random_shuffle(bons.begin(), bons.end()); for(auto cur : bons) { config[pid[cur]]=1; int val=ask(config); if(val!=tam*x) answer(0, cur); config[pid[cur]]=0; } }
#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...