Submission #344344

#TimeUsernameProblemLanguageResultExecution timeMemory
344344juggernautMeetings (JOI19_meetings)C++14
100 / 100
742 ms1004 KiB
#ifdef EVAL #else #include"grader.cpp" #endif #include"meetings.h" #include<bits/stdc++.h> using namespace std; void add(int x,int y){ if(x>y)swap(x,y); Bridge(x,y); } void go(vector<int>v){ if(v.size()<2)return; random_shuffle(v.begin(),v.end()); map<int,vector<int>>m; m[v[0]].push_back(v[0]); m[v[1]].push_back(v[1]); vector<int>path; for(int i=2;i<v.size();i++){ int x=Query(v[0],v[1],v[i]); if(!m.count(x))path.push_back(x); m[x].push_back(v[i]); } sort(path.begin(),path.end(),[&](int l,int r){return Query(v[0],l,r)==l;}); int last=v[0]; for(int x:path)add(last,x),last=x; add(last,v[1]); for(auto it:m)go(it.second); } void Solve(int n){ srand(time(0)); vector<int>all(n); iota(all.begin(),all.end(),0); go(all); }

Compilation message (stderr)

meetings.cpp: In function 'void go(std::vector<int>)':
meetings.cpp:19:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |  for(int i=2;i<v.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...