Submission #1170906

#TimeUsernameProblemLanguageResultExecution timeMemory
1170906PiokemonMeetings (JOI19_meetings)C++20
29 / 100
1366 ms1760 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; void rozw(vector<int> a){ int split = a[rand()%a.size()]; vector<vector<int>> zost; for (int x:a){ if (x==split)continue; bool jest=0; for (int nr=0;nr<zost.size();nr++){ //cerr << zost[nr][0] << ' ' << split << ' ' << x << " a\n"; if (Query(zost[nr][0],split,x) != split){ zost[nr].push_back(x); jest=1; break; } } if (!jest){ zost.push_back(vector<int>(0,0)); zost.back().push_back(x); } } for (vector<int> x:zost)rozw(x); for (vector<int> x:zost){ int v=x[rand()%x.size()]; for (int y=0;y<x.size();y++){ if (x[y]==v)continue; //cerr << split << ' ' << v << ' ' << x[y] << " b\n"; int temp = Query(split,v,x[y]); if (temp != v && temp!=split){ v=temp; //y=-1; } } //cerr << "bridge " << split << ' ' << v << '\n'; Bridge(min(split,v),max(split,v)); } } void Solve(int N) { srand(N*3+14); vector<int>a; for (int x=0;x<N;x++)a.push_back(x); rozw(a); return; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...