제출 #942625

#제출 시각아이디문제언어결과실행 시간메모리
942625yeediotMeetings (JOI19_meetings)C++14
100 / 100
725 ms3060 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=temp[rng()%temp.size()]; 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<path.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: */

컴파일 시 표준 에러 (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<path.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...