제출 #1216315

#제출 시각아이디문제언어결과실행 시간메모리
1216315tapilyocaThe Collection Game (BOI21_swaps)C++20
51 / 100
2 ms416 KiB
#include "swaps.h" #include<bits/stdc++.h> using namespace std; template<typename T> using vec = vector<T>; using ll = long long; using vll = vec<ll>; using pll = pair<ll,ll>; #define pb push_back #define dbg(x) if(1) cerr << #x << ": " << x << endl int n; void sched(int a, int b) { if(a >= n or b >= n) return; a++;b++; schedule(a,b); } void solve(int N, int V) { n = N; int nPow = ceil(log2(N)); int nPad = 1<<nPow; for(int i = 1; i <= nPow; i++) { // dbg(i); int blkSize = (1<<i); // query(1, n-k+1) for all the blocks for(int j = 0; j < N; j += blkSize) { for(int k = 0; k < blkSize/2; k++) { // dbg(j); // dbg(k); sched(j+k, j+blkSize-k-1); } } visit(); if(i > 1) { for(int j = blkSize / 2; j >= 1; j >>= 1) { // block size bool flag = 0; for(int k = 0; k < n; k += j) { // for each block for(int l = 0; l < j/2; l++) { // the thing // cerr << j << " " << k << " " << l << endl; flag = 1; sched(k+l, k+l+j/2); } } if(flag) visit(); } } } vec<int> ans(N); iota(ans.begin(),ans.end(),1); answer(ans); } /* 8 100 7 2 3 1 4 8 6 5 */
#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...