Submission #959767

#TimeUsernameProblemLanguageResultExecution timeMemory
959767josanneo22The Collection Game (BOI21_swaps)C++17
50 / 100
37 ms1924 KiB
#include <bits/stdc++.h> using namespace std; using i64 = long long; #define L(i,j,k) for(int i=(j);i<=(k);++i) #define R(i,j,k) for(int i=(j);i>=(k);--i) #define rep(i, n) L(i, 1, n) #define all(x) x.begin(),x.end() #define me(x,a) memset(x,a,sizeof(x)) #include<random> mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #include "swaps.h" const int nax = 505; int a[nax]; void odd_even(int N,int V) { if (N == 1) { answer({ 1 }); return; } L(i, 1, N) a[i] = i; int par = 0; for (int t = 0; t < N; t++) { int st = 1 + (par == 1); vector<pair<int,int>> q; for (int i = st; i + 1 <= N; i += 2) { schedule(a[i], a[i + 1]); q.push_back(make_pair(i, i + 1)); } vector<int> res = visit(); for (int i = 0; i < (int)res.size(); i++) { if (res[i] == 0) { swap(a[q[i].first], a[q[i].second]); } } par ^= 1; } vector<int> ans; L(i, 1, N) ans.push_back(a[i]); answer(ans); return; } void solve(int N, int V) { odd_even(N, V); return; }
#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...