Submission #164432

#TimeUsernameProblemLanguageResultExecution timeMemory
164432tneluccusMeetings (JOI19_meetings)C++14
100 / 100
1578 ms1016 KiB
#include<bits/stdc++.h> #include "meetings.h" using namespace std; const int num=2e3+2; vector<int> lis[num]; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //void Bridge(int x,int y){ // cout<<x<<' '<<y<<" yahyah"<<endl; //} //int Query(int x,int y,int z){ // cout<<x<<' '<<y<<' '<<z<<endl; // int t; // cin>>t; // return t; //} void solve1(int root){ int n=lis[root].size(),i,j,ran,ver; if(!n){ return; } vector<int> idx; vector<int> cac=lis[root]; lis[root].clear(); ran=rng()%n; // ran=n-1; ver=cac[ran]; idx.push_back(root); idx.push_back(ver); for(i=0;i<n;i++){ if(i==ran){ continue; } j=Query(root,ver,cac[i]); if(j==lis[root][i]){ idx.push_back(j); } else{ lis[j].push_back(cac[i]); } } sort(idx.begin(),idx.end(),[&](int x,int y){ //x is before y if(x==root){ return true; } if(y==root){ return false; } return Query(root,x,y)==x; }); // cout<<"lon"<<endl; // for(i=0;i<idx.size();i++){ // cout<<idx[i]<<' '; // } // cout<<"cac"<<endl; for(i=1;i<idx.size();i++){ Bridge(min(idx[i-1],idx[i]),max(idx[i],idx[i-1])); } for(i=0;i<idx.size();i++){ solve1(idx[i]); } } void Solve(int N){ int n=N,i,root=rng()%N; // root=0; for(i=0;i<n;i++){ if(i==root){ continue; } lis[root].push_back(i); } solve1(root); } //int main(){ // Solve(10); //}

Compilation message (stderr)

meetings.cpp: In function 'void solve1(int)':
meetings.cpp:55:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=1;i<idx.size();i++){
          ~^~~~~~~~~~~
meetings.cpp:58:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<idx.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...