제출 #141542

#제출 시각아이디문제언어결과실행 시간메모리
141542Bodo171Meetings (JOI19_meetings)C++14
0 / 100
115 ms632 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 solve(vector<int> v,int rad) { vector<int> path,aux; vector< pair<int,int> > out; if(v.empty()) return; if(v.size()==1) { Bridge(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); Bridge(rad,path[0]); Bridge(path.back(),nod); for(int i=0;i+1<path.size();i++) Bridge(path[i],path[i+1]); } else Bridge(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:24:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v.size();i++)
                 ~^~~~~~~~~
meetings.cpp:37:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i+1<path.size();i++)
                 ~~~^~~~~~~~~~~~
meetings.cpp:43:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<out.size();i++)
                 ~^~~~~~~~~~~
meetings.cpp:46: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...