Submission #205210

#TimeUsernameProblemLanguageResultExecution timeMemory
205210egekabasMeetings (JOI19_meetings)C++14
29 / 100
3080 ms1484 KiB
#include <bits/stdc++.h> #include "meetings.h" #define ff first #define ss second #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<ull, ull> pull; typedef pair<int, int> pii; typedef pair<ld, ld> pld; int p[2009]; void calc(int root, vector<int> all){ if(all.size() <= 1) return; for(auto it = all.begin(); it < all.end(); ++it) if(*it == root){ all.erase(it); break; } vector<vector<int>> groups; for(auto u : all){ int put = 0; for(auto &v : groups){ if(Query(v.front(), u, root) != root){ v.pb(u); put = 1; break; } } if(put == 0){ groups.pb({u}); } } for(auto v : groups){ int nextroot = v[0]; for(int i = 1; i < v.size(); ++i) if(v[i] != nextroot) nextroot = Query(root, nextroot, v[i]); p[nextroot] = root; calc(nextroot, v); } } void Solve(int n){ vector<int> all; for(int i = 0; i < n; ++i) all.pb(i); calc(0, all); for(int i = 1; i < n; ++i) Bridge(min(i, p[i]), max(i, p[i])); }

Compilation message (stderr)

meetings.cpp: In function 'void calc(int, std::vector<int>)':
meetings.cpp:39:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 1; i < v.size(); ++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...