Submission #415757

#TimeUsernameProblemLanguageResultExecution timeMemory
415757KoDThe Collection Game (BOI21_swaps)C++17
25 / 100
164 ms336 KiB
#include <bits/stdc++.h> #include "swaps.h" template <class T> using Vec = std::vector<T>; void solve(int N, int V) { if (V == 5000) { Vec<char> done(N); Vec<int> ans; while (true) { Vec<int> remain; for (int i = 0; i < N; ++i) { if (!done[i]) { remain.push_back(i); } } if (remain.empty()) { break; } while (remain.size() > 1) { Vec<int> next; Vec<std::array<int, 2>> ask; for (int i = 0; i + 1 < (int) remain.size(); i += 2) { schedule(remain[i] + 1, remain[i + 1] + 1); ask.push_back({remain[i + 1], remain[i]}); } const auto ret = visit(); for (int i = 0; i < (int) ret.size(); ++i) { next.push_back(ask[i][ret[i]]); } if (remain.size() % 2 == 1) { next.push_back(remain.back()); } remain = std::move(next); } done[remain[0]] = true; ans.push_back(remain[0] + 1); } answer(ans); } else { } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...