제출 #375117

#제출 시각아이디문제언어결과실행 시간메모리
375117daniel920712Meetings (JOI19_meetings)C++14
17 / 100
3070 ms1132 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) if(j>i&&k>j) ans[i][j][k]=Query(i,j,k); while(have.size()>2) { for(auto i:have) { //printf("aa %d\n",i); con[i]=0; for(auto j:have) how[i][j]=0; } //printf("\n"); for(auto i:have) { for(auto j:have) { for(auto k:have) { if(k>j&&j>i) { t=ans[i][j][k]; 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); } } //if(tt.empty()) i=0/0; 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...