Submission #236647

#TimeUsernameProblemLanguageResultExecution timeMemory
236647MvCMeetings (JOI19_meetings)C++14
29 / 100
1020 ms1528 KiB
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include<bits/stdc++.h> #include "meetings.h" #define fr first #define sc second #define vec vector #define pb push_back #define pii pair<int, int> #define forn(x,y) for(int x = 1 ; x <= (int)y ; ++x) #define all(x) (x).begin(),(x).end() #define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0); using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); typedef long long ll; typedef unsigned int uint; typedef complex<int> point; const int nmax = 2005; const ll linf = 1e18; const ll mod = 998244353; const int inf = INT_MAX; vec < pii > eds; int A,n,vz[nmax],u; vector<int>vc[nmax]; /*int Query(int x,int y,int z) { cout<<"Q "<<x<<" "<<y<<" "<<z<<endl; int rs; cin>>rs; return rs; }*/ bool cmp(int x,int y) { u++; return Query(A,x,y)==x; } void solves(vec <int> tb){ if(tb.size() == 1)return ; if(tb.size()==2) { eds.pb({tb[0],tb[1]}); return; } srand(time(0)); for(int i:tb)vc[i].clear(),vz[i]=0; int m=tb.size(),B; A=B=0; while(B == A)B = tb[rand()%m],A=tb[rand()%m]; vector<int>pth; for(int i : tb){ if(i != A && i != B && Query(A,B,i) == i) u++,pth.pb(i); } pth.pb(B); sort(all(pth),cmp); reverse(all(pth)); pth.pb(A); for(int i=1;i<pth.size();i++)eds.pb({pth[i-1],pth[i]}); for(int i=0;i<pth.size();i++)vz[pth[i]]=1,vc[pth[i]].pb(pth[i]); for(int i : tb){ if(!vz[i]) { vc[Query(A,B,i)].pb(i); u++; } } for(int i=0;i<pth.size();i++) { solves(vc[pth[i]]); } } void Solve(int n) { vec < int > asd; for(int i= 0; i <n ;i++)asd.pb(i); solves(asd); assert(u<=25000); for(pii ed : eds){ Bridge(min(ed.fr,ed.sc),max(ed.fr,ed.sc)); } } /*int main() { //freopen("sol.in","r",stdin); //freopen("sol.out","w",stdout); //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0); cin>>n; return 0; }*/

Compilation message (stderr)

meetings.cpp: In function 'void solves(std::vector<int>)':
meetings.cpp:62:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1;i<pth.size();i++)eds.pb({pth[i-1],pth[i]});
              ~^~~~~~~~~~~
meetings.cpp:63:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<pth.size();i++)vz[pth[i]]=1,vc[pth[i]].pb(pth[i]);
              ~^~~~~~~~~~~
meetings.cpp:71:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<pth.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...