Submission #375109

#TimeUsernameProblemLanguageResultExecution timeMemory
375109daniel920712Meetings (JOI19_meetings)C++14
0 / 100
2 ms620 KiB
#include "meetings.h" #include <vector> #include <set> #include <utility> #include <stdio.h> using namespace std; int how[2005][2005]; int con[2005]; int ans[55][55][55]; set < int > have; set < int > tt; vector < pair < int , int > > road; void Solve(int N) { int t,i,x,y; for(i=0;i<N;i++) have.insert(i); for(auto i:have) for(auto j:have) for(auto k:have) ans[i][j][k]=Query(i,j,k); while(have.size()>2) { for(auto i:have) { for(auto j:have) how[i][j]=0; } for(auto i:have) { for(auto j:have) { for(auto k:have) { if(k>j&&j>i) { t=ans[i][j][k]; //printf("%d %d %d %d\n",i,j,k,t); if(t==i) { con[i]++; how[j][i]++; how[k][i]++; } if(t==j) { con[j]++; how[i][j]++; how[k][j]++; } if(t==k) { con[k]++; how[i][k]++; how[j][k]++; } } } } } for(auto i:have) { if(con[i]==0) { x=0; y=0; for(auto j:have) { x=max(x,how[i][j]); if(x==how[i][j]) y=j; } road.push_back(make_pair(i,y)); tt.insert(i); } } for(auto i:tt) have.erase(i); tt.clear(); } if(have.size()==2) { road.push_back(make_pair(*have.begin(),*(prev(have.end())))); } for(auto i:road) { Bridge(min(i.first,i.second),max(i.first,i.second)); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...