제출 #141543

#제출 시각아이디문제언어결과실행 시간메모리
141543Bodo171Meetings (JOI19_meetings)C++14
100 / 100
1806 ms940 KiB
#include "meetings.h" #include <iostream> #include <vector> #include <algorithm> #include <ctime> #include <cstdlib> using namespace std; int A; bool cmp(int x,int y) { return (Query(A,x,y)==x); } void ss(int x,int y) { if(x>y) swap(x,y); Bridge(x,y); } void solve(vector<int> v,int rad) { vector<int> path,aux; vector< pair<int,int> > out; if(v.empty()) return; if(v.size()==1) { ss(rad,v[0]); return; } int nod=v[rand()%v.size()],x; for(int i=0;i<v.size();i++) if(v[i]!=nod) { x=Query(rad,nod,v[i]); if(x==v[i]) path.push_back(v[i]); else out.push_back({x,v[i]}); } A=rad; if(path.size()) { sort(path.begin(),path.end(),cmp); ss(rad,path[0]); ss(path.back(),nod); for(int i=0;i+1<path.size();i++) ss(path[i],path[i+1]); } else ss(rad,nod); sort(out.begin(),out.end()); int j=0; for(int i=0;i<out.size();i++) { aux.resize(0); while(j<out.size()&&out[i].first==out[j].first) { aux.push_back(out[j].second); j++; } solve(aux,out[i].first); i=j-1; } } void Solve(int N) { srand(time(NULL)); vector<int> ini; for(int i=1;i<N;i++) ini.push_back(i); solve(ini,0); }

컴파일 시 표준 에러 (stderr) 메시지

meetings.cpp: In function 'void solve(std::vector<int>, int)':
meetings.cpp:29:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v.size();i++)
                 ~^~~~~~~~~
meetings.cpp:42:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i+1<path.size();i++)
                 ~~~^~~~~~~~~~~~
meetings.cpp:48:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<out.size();i++)
                 ~^~~~~~~~~~~
meetings.cpp:51:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while(j<out.size()&&out[i].first==out[j].first)
               ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...