Submission #1170903

#TimeUsernameProblemLanguageResultExecution timeMemory
1170903bbartekMeetings (JOI19_meetings)C++20
0 / 100
1279 ms1232 KiB
#include <bits/stdc++.h> #include "meetings.h" using namespace std; typedef long long ll; #define st first #define nd second #define pb push_back const int maxn = 2003; bool polaczone[maxn]; vector<int> synowie[maxn]; vector<int> kolejnosc; bool porownaj(int a,int b){ return synowie[a].size() < synowie[b].size(); } void Solve(int n) { //Query(a,b,c)//Bridge(a,b)// int x; for(int i=1;i<n;i++){ for(int j=i+1;j<n;j++){ x = Query(0,i,j); if(x == i){ synowie[i].pb(j); } else{ synowie[j].pb(i); } } kolejnosc.pb(i); } sort(kolejnosc.begin(),kolejnosc.end(),porownaj); for(auto i : kolejnosc){ for(auto j : synowie[i]){ if(polaczone[j]) continue; Bridge(i,j); polaczone[j] = 1; } } for(int i=1;i<n;i++){ if(!polaczone[i]) Bridge(0,i); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...