Submission #1049777

#TimeUsernameProblemLanguageResultExecution timeMemory
1049777shiomusubi496The Collection Game (BOI21_swaps)C++17
25 / 100
55 ms892 KiB
// // --- Sample implementation for the task swaps --- // // To compile this program with the sample grader, place: // swaps.h swaps_sample.cpp sample_grader.cpp // in a single folder and run: // g++ swaps_sample.cpp sample_grader.cpp // in this folder. // #include "swaps.h" #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i) #define rrep2(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i) #define all(v) begin(v), end(v) #define rall(v) rbegin(v), rend(v) using namespace std; using ll = long long; template<class T, class U> bool chmin(T& a, const U& b) { return a > b ? a = b, true : false; } template<class T, class U> bool chmax(T& a, const U& b) { return a < b ? a = b, true : false; } void solve(int N, int V) { vector<bool> used(N); vector<int> ans; rep (_, N) { vector<int> vs; rep (i, N) { if (used[i]) continue; vs.push_back(i); } while (vs.size() >= 2) { vector<int> nv; rep (i, vs.size() / 2) schedule(vs[i * 2] + 1, vs[i * 2 + 1] + 1); auto res = visit(); rep (i, vs.size() / 2) { if (res[i] == 1) nv.push_back(vs[i * 2]); else nv.push_back(vs[i * 2 + 1]); } if (vs.size() % 2 == 1) nv.push_back(vs.back()); vs = nv; } used[vs[0]] = true; ans.push_back(vs[0] + 1); } answer(ans); } /* sub2. マージソートの各マージを並列にすると通る */
#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...