Submission #151437

#TimeUsernameProblemLanguageResultExecution timeMemory
151437usernameMeetings (JOI19_meetings)C++14
0 / 100
48 ms504 KiB
#include "meetings.h" #define VIS(it,con) for(auto it=con.begin();it!=con.end();++it) #include<bits/stdc++.h> //#define int int_fast64_t using namespace std; typedef pair<int,int> pii; #define REP(i,j,k) for(register int i=(j);i<(k);++i) #define RREP(i,j,k) for(register int i=int(j)-1;i>=(k);--i) #define ALL(a) a.begin(),a.end() #define pb push_back #define f first #define s second #define de(...) cerr<<__VA_ARGS__ #define ar(a,s,t) {REP(__i,s,t)de(a[__i]<<' ');de(endl);} mt19937 rd(time(0)); int o; map<pii,int>rec; int qr(int a,int b){ if(rec.count({a,b}))return rec[{a,b}]; int ret=Query(o+1,a+1,b+1)-1; rec[{a,b}]=ret; return ret; } void solve(int rt,vector<int>v){ if(v.size()==1)return; int u=rt; while(u==rt)u=v[rd()%v.size()]; map<int,vector<int>>mp; REP(i,0,v.size())mp[qr(u,v[i])].pb(v[i]); vector<int>path; VIS(it,mp){ solve(it->f,it->s); path.pb(it->f); } sort(ALL(path),[](int a,int b){return qr(a,b)==a;}); REP(i,1,path.size())Bridge(path[i-1],path[i]); } void Solve(int n){ o=rd()%n; vector<int>v; REP(i,0,n)v.pb(i); solve(o,v); }

Compilation message (stderr)

meetings.cpp: In function 'void solve(int, std::vector<int>)':
meetings.cpp:7:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,j,k) for(register int i=(j);i<(k);++i)
                                            ^
meetings.cpp:32:2: note: in expansion of macro 'REP'
  REP(i,0,v.size())mp[qr(u,v[i])].pb(v[i]);
  ^~~
meetings.cpp:7:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,j,k) for(register int i=(j);i<(k);++i)
                                            ^
meetings.cpp:39:2: note: in expansion of macro 'REP'
  REP(i,1,path.size())Bridge(path[i-1],path[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...