Submission #684515

#TimeUsernameProblemLanguageResultExecution timeMemory
684515elkernosMeetings (JOI19_meetings)C++17
100 / 100
785 ms1004 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; #define sz(x) (int)(x).size() mt19937 gen(1322135); vector<vector<int>> todo; void rek(vector<int> wek) { if (sz(wek) <= 1) return; shuffle(wek.begin(), wek.end(), gen); int from = wek[0], to = wek[1]; vector<int> path{from}; for (int i : wek) todo[i].clear(); todo[from].push_back(from); todo[to].push_back(to); auto pisz = [&](int a, int b) { Bridge(min(a, b), max(a, b)); }; auto pyt = [&](int a, int b, int c) { return Query(a, b, c); }; for (int i = 2; i < sz(wek); i++) { int pyt = Query(from, to, wek[i]); todo[pyt].push_back(wek[i]); if (pyt == wek[i]) path.push_back(wek[i]); } path.push_back(to); if (sz(path) >= 4) sort(path.begin() + 1, path.end() - 1, [&](int i, int j) { return Query(from, j, i) == i; }); for (int i = 0; i + 1 < sz(path); i++) pisz(path[i], path[i + 1]); for (int i : wek) rek(todo[i]); } void Solve(int N) { vector<int> all; for (int i = 0; i < N; i++) all.push_back(i); todo.resize(N); rek(all); }

Compilation message (stderr)

meetings.cpp: In function 'void rek(std::vector<int>)':
meetings.cpp:19:10: warning: variable 'pyt' set but not used [-Wunused-but-set-variable]
   19 |     auto pyt = [&](int a, int b, int c) { return Query(a, b, c); };
      |          ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...