제출 #263250

#제출 시각아이디문제언어결과실행 시간메모리
263250NicolaAbusaad2014통행료 (IOI18_highway)C++14
0 / 100
72 ms3576 KiB
#include "highway.h" #include <bits/stdc++.h> using namespace std; long long mn,a,m; int T; map<long,map<long,long> >mp; vector<vector<long> >edges; void dfs(long n,long p,long d) { if(d==mn){ std::vector<int> w(m); for (int i = 0; i < m; ++i) { w[i] = 0; if(i==mp[n][p]){ w[i]=1; } } long long toll = ask(w); if(toll>(mn*a)){ T=n; } return; } for(long i=0;i<(long)edges[n].size();i++){ dfs(edges[n][i],n,d+1); } } void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) { int M = U.size(); a=A; m=M; vector<int> w(M); for (int i = 0; i < M; ++i) { w[i] = 0; } mn=(ask(w)/A); edges.resize(N); for(long i=0;i<M;i++){ edges[V[i]].push_back(U[i]); edges[U[i]].push_back(V[i]); mp[V[i]][U[i]]=i; mp[U[i]][V[i]]=i; } dfs(0,0,0); answer(0,T); }
#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...