Submission #921614

#TimeUsernameProblemLanguageResultExecution timeMemory
9216141075508020060209tcMeetings (JOI19_meetings)C++14
Compilation error
0 ms0 KiB
#pragma GCC optimize("O3") #include "meetings.h" #include<bits/stdc++.h> using namespace std; //#define int long long #define X first #define Y second #define SZ(x) (int)(x).size() unsigned seed=12345; long long rnd(){ seed=seed^(seed<<7); seed=seed^(seed>>4); seed=seed^(seed>>3); return seed; } map<vector<int>,int>mp; int n; int query(int a,int b,int c){ vector<int>vc={a,b,c}; sort(vc.begin(),vc.end()); if(mp[vc]){return mp[vc];} mp[vc]=Query(vc[0],vc[1],vc[2])+1; return mp[vc]; } set<pair<int,int>>ans; int finmid(vector<int>&vc){ int a=rnd()%vc.size(); int b=rnd()%vc.size(); if(b==a){b++;b%=vc.size();} int c=rnd()%vc.size(); if(c==a){ c++;c%=vc.size(); } if(c==b){ c++;c%=vc.size(); } return query(vc[a],vc[b],vc[c]); } void slv(vector<int>vc){ if(vc.size()==1){return;} if(vc.size()==2){ ans.insert({min(vc[0],vc[1]),max(vc[0],vc[1])}); return; } int md=finmid(vc); vector<int>vca; vector<int>vcb; int v=vc[0]; if(v==md){v=vc[1];} vca.push_back(v); vcb.push_back(md); for(int i=0;i<vc.size();i++){ if(vc[i]==v||vc[i]==md){continue;} int vv=query(md,v,vc[i]); if(vv==md){ vcb.push_back(vc[i]); }else{ v=vv; } } ans.insert({min(md,v),max(md,v)}); slv(vca,vcb); } void Solve(int N){ n=N; vector<int>vc; for(int i=1;i<=n;i++){ vc.push_back(i); } slv(vc); for(auto it=ans.begin();it!=ans.end();it++){ Bridge((*it).first-1, (*it).second-1); } }

Compilation message (stderr)

meetings.cpp: In function 'void slv(std::vector<int>)':
meetings.cpp:57:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 | for(int i=0;i<vc.size();i++){
      |             ~^~~~~~~~~~
meetings.cpp:67:12: error: too many arguments to function 'void slv(std::vector<int>)'
   67 | slv(vca,vcb);
      |            ^
meetings.cpp:44:6: note: declared here
   44 | void slv(vector<int>vc){
      |      ^~~