Submission #429153

#TimeUsernameProblemLanguageResultExecution timeMemory
429153koioi.org-koosagaMeetings (JOI19_meetings)C++17
Compilation error
0 ms0 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; using pi = pair<int, int>; mt19937 rng(0x14004); int randint(int lb, int ub){ return uniform_int_distribution<int>(lb, ub)(rng); } void bridge(int x, int y){ Bridge(min(x, y), max(x, y)); } void dfs(vector<int> v){ if(v.size() == 1) return; if(v.size() == 2){ bridge(v[0], v[1]); return; } shuffle(v.begin(), v.end(), rng); vector<pi> ords; ords.emplace_back(v[0], v[0]); ords.emplace_back(v[1], v[1]); for(int i=2; i<v.size(); i++){ int q = Query(v[0], v[1], v[i]); ords.emplace_back(q, i); } sort(ords.begin(), ords.end(), [&](pi a, pi b){ if(a.first != b.first) return Query(v[0], a.first, b.first) == a.first; return a.second < b.second; }); for(int i = 0; i < sz(ords); ){ int e = i; while(e < sz(ords) && ords[i].first == ords[e].first){ w.push_back(ords[e++].second); } swap(w[0], *find(w.begin(), w.end(), ords[i].first)); dfs(w); if(e < sz(ords)) Bridge(ords[i].first, ords[e].first); i = e; } } void Solve(int N) { vector<int> v(N); iota(v.begin(), v.end(), 0); dfs(v); }

Compilation message (stderr)

meetings.cpp: In function 'void dfs(std::vector<int>)':
meetings.cpp:21:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for(int i=2; i<v.size(); i++){
      |               ~^~~~~~~~~
meetings.cpp:29:21: error: 'sz' was not declared in this scope
   29 |  for(int i = 0; i < sz(ords); ){
      |                     ^~
meetings.cpp:32:4: error: 'w' was not declared in this scope
   32 |    w.push_back(ords[e++].second);
      |    ^
meetings.cpp:34:8: error: 'w' was not declared in this scope
   34 |   swap(w[0], *find(w.begin(), w.end(), ords[i].first));
      |        ^