Submission #1092897

#TimeUsernameProblemLanguageResultExecution timeMemory
1092897PanndaMeetings (JOI19_meetings)C++17
29 / 100
1055 ms1672 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; void Solve(int n) { mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); auto work = [&](auto self, vector<int> dom) -> void { shuffle(dom.begin(), dom.end(), rng); int r = dom.back(); dom.pop_back(); vector<vector<int>> branches; vector<int> heads; for (int u : dom) { bool found = false; for (int i = 0; !found && i < heads.size(); i++) { int get = Query(r, u, heads[i]); if (get == r) { // nothing } else if (get == u) { heads[i] = u; branches[i].push_back(u); found = true; } else { branches[i].push_back(u); found = true; } } if (!found) { heads.push_back(u); branches.push_back({u}); } } for (int u : heads) { if (r < u) Bridge(r, u); else Bridge(u, r); } for (vector<int> branch : branches) { self(self, branch); } }; work(work, [&]() -> vector<int> { vector<int> dom(n); iota(dom.begin(), dom.end(), 0); return dom; }()); }

Compilation message (stderr)

meetings.cpp: In lambda function:
meetings.cpp:18:41: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |             for (int i = 0; !found && i < heads.size(); i++) {
      |                                       ~~^~~~~~~~~~~~~~
meetings.cpp: In instantiation of 'Solve(int)::<lambda(auto:23, std::vector<int>)> [with auto:23 = Solve(int)::<lambda(auto:23, std::vector<int>)>]':
meetings.cpp:51:8:   required from here
meetings.cpp:18:41: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...