Submission #119196

#TimeUsernameProblemLanguageResultExecution timeMemory
119196KLPPMeetings (JOI19_meetings)C++14
100 / 100
643 ms1680 KiB
#include "meetings.h" #include<bits/stdc++.h> using namespace std; typedef pair<int,int> pii; #define rep(i,a,b) for(int i=a;i<b;i++) #define trav(a,v) for(auto a:v) vector<pair<int,int> >edges; int PNT; bool cmp(int a, int b){ if(Query(PNT,a,b)==a)return true; return false; } void solve(vector<int> v){ if(v.size()==1)return; if(v.size()==2){ sort(v.begin(),v.end()); //cout<<v[0]<<" "<<v[1]<<endl; Bridge(v[0],v[1]); return; } random_shuffle(v.begin(),v.end()); int x=v[0]; int y=v[1]; //cout<<x<<" "<<y<<endl; int answer[v.size()]; answer[0]=-1; answer[1]=-1; map<int,vector<int> >m; rep(i,0,v.size()){ vector<int> N; m[i]=N; } rep(i,2,v.size()){ answer[i]=Query(x,y,v[i]); //cout<<answer[i]<<" "<<v[i]<<" "<<x<<" "<<y<<endl; m[answer[i]].push_back(v[i]); } m[x].push_back(x); m[y].push_back(y); set<int> line; line.insert(y); trav(p,m){ //cout<<p.first<<" "<<p.second.size()<<" "<<x<<" "<<y<<endl; if(p.second.size()>0){ solve(p.second); if(p.first!=x)line.insert(p.first); } } line.erase(x); vector<int> Line; trav(a,line)Line.push_back(a); PNT=x; sort(Line.begin(),Line.end(),cmp); reverse(Line.begin(),Line.end()); Line.push_back(x); rep(i,0,Line.size()-1){ //cout<<Line[i]<<" "<<Line[i+1]<<endl; Bridge(min(Line[i],Line[i+1]),max(Line[i],Line[i+1])); } } void Solve(int N) { vector<int> test; rep(i,0,N)test.push_back(i); solve(test); }

Compilation message (stderr)

meetings.cpp: In function 'void solve(std::vector<int>)':
meetings.cpp:6:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,a,b) for(int i=a;i<b;i++)
meetings.cpp:30:7:
   rep(i,0,v.size()){
       ~~~~~~~~~~~~               
meetings.cpp:30:3: note: in expansion of macro 'rep'
   rep(i,0,v.size()){
   ^~~
meetings.cpp:6:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,a,b) for(int i=a;i<b;i++)
meetings.cpp:34:7:
   rep(i,2,v.size()){
       ~~~~~~~~~~~~               
meetings.cpp:34:3: note: in expansion of macro 'rep'
   rep(i,2,v.size()){
   ^~~
meetings.cpp:6:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,a,b) for(int i=a;i<b;i++)
meetings.cpp:57:7:
   rep(i,0,Line.size()-1){
       ~~~~~~~~~~~~~~~~~          
meetings.cpp:57:3: note: in expansion of macro 'rep'
   rep(i,0,Line.size()-1){
   ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...