Submission #299873

#TimeUsernameProblemLanguageResultExecution timeMemory
299873YJUMeetings (JOI19_meetings)C++14
0 / 100
67 ms512 KiB
#include<bits/stdc++.h> #include "meetings.h" using namespace std; typedef int ll; typedef pair<ll,ll> pll; typedef long double ld; const ll MOD=1e9+7; const ll N=2e3+5; const ld pi=3.14159265359; const ll INF=(1LL<<62); #define REP(i,n) for(ll i=0;i<n;i++) #define REP1(i,n) for(ll i=1;i<=n;i++) #define pb push_back #define mp make_pair #define X first #define Y second #define setp setprecision #define lwb lower_bound #define SZ(a) (ll)a.size() ll dg[N]; vector<pll> ed; void build(ll nl,ll nr,vector<ll> v){ vector<ll> l,r,midr,midl,line,mid; ll id=N-1; for(ll i:v){ ll x=Query(nl,nr,i); if(x==nl){ l.pb(x); }else if(x==nr){ r.pb(x); }else{ if(x==i)line.pb(i); ++dg[x];mid.pb(i); id=(dg[x]>dg[id]?x:id); } } if(SZ(line)==0){ed.pb(mp(nl,nr));return ;} for(ll i:line){ dg[i]=0; ll x=Query(nl,id,i); if(x==i){midl.pb(i);}else{midr.pb(i);} } random_shuffle(l.begin(),l.end()); random_shuffle(r.begin(),r.end()); ll ndl=l[0],ndr=r[0]; r.erase(r.begin()); l.erase(l.begin()); build(ndl,nl,l); build(ndr,nr,r); build(nl,id,midl); build(id,nr,midr); return ; } void Solve(ll n){ srand(clock()); vector<ll> v; for(int i=2;i<n;i++)v.pb(i); build(0,1,v); for(auto i:ed)Bridge(i.X,i.Y); }

Compilation message (stderr)

meetings.cpp:10:18: warning: overflow in conversion from 'long long int' to 'll' {aka 'int'} changes value from '4611686018427387904' to '0' [-Woverflow]
   10 | const ll INF=(1LL<<62);
      |              ~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...