Submission #120395

#TimeUsernameProblemLanguageResultExecution timeMemory
120395pavelMeetings (JOI19_meetings)C++14
0 / 100
80 ms540 KiB
#include <vector> #include <map> #include <algorithm> #include "meetings.h" using namespace std; struct cmp{ int a; cmp(int b){ a=b; } bool operator()(int x, int y){ if(x==a) return y!=a; if(y==a) return false; return Query(a, x, y)==x; } }; void SolveSubTree(vector<int> nodes){ if(nodes.size()<=1) return; int a=nodes[0], b=nodes[1]; map<int, vector<int>> sts; sts[a].push_back(a); sts[b].push_back(b); for(int j=2;j<nodes.size();++j){ int x = Query(a, b, nodes[j]); sts[x].push_back(nodes[j]); } vector<int> path; for(auto i:sts){ path.push_back(i.first); } sort(path.begin(), path.end(), cmp(a)); for(int i=1;i<path.size();++i){ Bridge(path[i-1], path[i]); } for(auto i:sts){ SolveSubTree(i.second); } } void Solve(int N) { vector<int> s; for(int i=0;i<N;++i) s.push_back(i); SolveSubTree(s); }

Compilation message (stderr)

meetings.cpp: In function 'void SolveSubTree(std::vector<int>)':
meetings.cpp:28:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int j=2;j<nodes.size();++j){
                 ~^~~~~~~~~~~~~
meetings.cpp:39:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=1;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...