Submission #1207709

#TimeUsernameProblemLanguageResultExecution timeMemory
1207709jasonicThe Collection Game (BOI21_swaps)C++20
0 / 100
0 ms408 KiB
#include "swaps.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define fastIO cin.tie(0); ios::sync_with_stdio(false) vector<int> a; bool compare(const int x, const int y) { schedule(x, y); vector<int> z = visit(); assert(size(z) == 1); return 1; } void conquer(int l_l, int l_r, int r_l, int r_r) { queue<int> l, r, f; for(int i = l_l; i <= l_r; i++) l.push(a[i]); for(int i = r_l; i <= r_r; i++) r.push(a[i]); while(!l.empty() && !r.empty()) { if(compare(l.front(), r.front())) { // left is bigger f.push(l.front()); l.pop(); } else { f.push(r.front()); r.pop(); } } while(!l.empty()) { f.push(l.front()); l.pop(); } while(!r.empty()) { f.push(r.front()); r.pop(); } for(int i = l_l; i <= r_r; i++) { a[i] = f.front(); f.pop(); } } void divide(int l, int r) { if(l != r) { int m = (l+r)/2; divide(l, m); divide(m+1, r); conquer(l, m, m+1, r); } } void solve(int N, int V) { a = vector<int>(N); for(int i = 0; i < N; i++) a[i] = i+1; divide(0, N-1); answer(a); }
#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...