Submission #409931

#TimeUsernameProblemLanguageResultExecution timeMemory
409931CaroLindaThe Collection Game (BOI21_swaps)C++14
25 / 100
97 ms552 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 sz(x) (int)(x.size()) #define all(x) x.begin(),x.end() using namespace std ; vector<int> r ; void solve(int N, int V) { vector<int> v(N,-1) ; vector<int> space(N) ; iota(all(space), 1 ) ; int idx_max = 0 ; while( !space.empty() ) { vector<int> aux = space ; while( sz(aux) > 1 ) { int p = ((sz(aux)+1)/2) ; for(int i = 0 ; i < sz(aux)/2 ; i++ ) if( i+p < sz(aux) ) schedule(aux[i] , aux[p+i]) ; r = visit() ; for(int i = 0 ; i < sz(aux)/2 ; i++ ) if( !r[i] ) aux[i] = aux[i+p] ; while(sz(aux) > p ) aux.pop_back() ; } v[ idx_max++ ] = aux[0] ; for(int i = 0 ; i < sz(space) ; i++ ) if(space[i] == aux[0]) { swap(space[i] , space.back() ) ; space.pop_back() ; break ; } } answer(v) ; }
#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...