Submission #135693

#TimeUsernameProblemLanguageResultExecution timeMemory
135693dndhkMeetings (JOI19_meetings)C++14
0 / 100
121 ms596 KiB
#include "meetings.h" #include <bits/stdc++.h> #define pb push_back #define all(v) ((v).begin(), (v).end()) #define sortv(v) sort(all(v)) #define sz(v) ((int)(v).size()) #define uniqv(v) (v).erase(unique(all(v)), (v).end()) #define umax(a, b) (a)=max((a), (b)) #define umin(a, b) (a)=min((a), (b)) #define FOR(i,a,b) for(int i = (a); i <= (b); i++) #define rep(i,n) FOR(i,1,n) #define rep0(i,n) FOR(i,0,(int)(n)-1) #define FI first #define SE second #define INF 2000000000 #define INFLL 1000000000000000000LL using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAX_N = 2000; int N; vector<int> vt[MAX_N+1]; vector<int> v; vector<int> arr; vector<int> tmp; int now; bool sf(int a, int b){ int k = Query(now, a, b); return (k==a); } void calc(){ while(!v.empty()){ now = v.back(); v.pop_back(); //cout<<now; if(vt[now].size()==0) continue; int r = vt[now][rand()%vt[now].size()]; //cout<<" "<<r<<endl; tmp = vt[now]; while(!vt[now].empty()) vt[now].pop_back(); for(int i=0; i<tmp.size(); i++){ int j = tmp[i]; if(j==r){ continue; } //cout<<now<<" "<<r<<" "<<j<<endl; int k = Query(now, r, j); if(k==j){ arr.pb(j); }else{ vt[k].pb(j); } } if(arr.empty()){ Bridge(now, r); v.pb(now); v.pb(r); continue; } sort(arr.begin(), arr.end()); v.pb(now); v.pb(r); Bridge(now, arr[0]); Bridge(arr.back(), r); int prv = arr.back(); arr.pop_back(); v.pb(prv); while(!arr.empty()){ Bridge(arr.back(), prv); prv = arr.back(); arr.pop_back(); v.pb(prv); } } } void Solve(int n) { srand(time(NULL)); N = n; for(int i=1; i<N; i++){ vt[0].pb(i); } v.pb(0); calc(); }

Compilation message (stderr)

meetings.cpp: In function 'void calc()':
meetings.cpp:50:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0; i<tmp.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...