Submission #942616

#TimeUsernameProblemLanguageResultExecution timeMemory
942616yeediotMeetings (JOI19_meetings)C++14
0 / 100
47 ms700 KiB
#include "meetings.h" #include<bits/stdc++.h> using namespace std; mt19937 rng(time(0)); int K; bool cmp(int a,int b){ return Query(K,a,b)==a; } void qq(int a,int b){ if(a>b)swap(a,b); Bridge(a,b); } int n; void go(int k,vector<int>temp){ if(temp.size()==0)return; int k2=rng()%n; K=k; vector<int>child[n],path; for(auto i:temp){ if(i==k2)continue; int p=Query(k,k2,i); if(p==i){ path.push_back(i); } else{ child[p].push_back(i); } } sort(path.begin(),path.end(),cmp); path.push_back(k2); for(int i=0;i<temp.size();i++){ if(!i){ qq(k,path[i]); } else{ qq(path[i-1],path[i]); } } go(k,child[k]); for(auto i:path){ go(i,child[i]); } } void Solve(int N){ n=N; int k=rng()%n; vector<int>temp; for(int i=0;i<n;i++){ if(i!=k)temp.push_back(i); } go(k,temp); } /* input: */

Compilation message (stderr)

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