Submission #223129

#TimeUsernameProblemLanguageResultExecution timeMemory
223129AQTMeetings (JOI19_meetings)C++14
100 / 100
1721 ms1144 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void rec(vector<int> v){ if(v.size() == 1){ return; } else if(v.size() == 2){ Bridge(min(v[0], v[1]), max(v[0], v[1])); return; } shuffle(v.begin(), v.end(), rng); //random_shuffle(v.begin(), v.end()); int c = Query(v[0], v[1], v[2]); vector<vector<int>> st; for(int i = 0; i<v.size(); i++){ int n = v[i]; if(n == c){ continue; } bool b = 0; for(int j = 0; j<st.size(); j++){ if(Query(n, st[j][0], c) != c){ b = 1; st[j].push_back(n); break; } } if(!b){ st.push_back({n}); } } for(auto k : st){ int lca = k[0]; for(int j = 1; j<k.size(); j++){ if(lca != k[j]){ lca = Query(lca, k[j], c); } } //cout << min(lca, c) << " " << max(lca, c) << "\n"; Bridge(min(lca, c), max(lca, c)); rec(k); } } void Solve(int N) { vector<int> v; for(int i = 0; i<N; i++){ v.push_back(i); } rec(v); }

Compilation message (stderr)

meetings.cpp: In function 'void rec(std::vector<int>)':
meetings.cpp:19:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i<v.size(); i++){
                 ~^~~~~~~~~
meetings.cpp:25:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 0; j<st.size(); j++){
                  ~^~~~~~~~~~
meetings.cpp:38:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 1; j<k.size(); j++){
                  ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...