| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1295153 | glupan | The Collection Game (BOI21_swaps) | C++20 | 0 ms | 0 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>
using namespace std;
void solve(int N, int V) {
int TMP=1;
vector<int>idx;
for(int i=1; i<=N; i++) idx.push_back(i);
for(int v=1; v<=V; v++) {
vector<int>vec;
if(v%2) TMP=1;
else TMP=2;
for(int i=TMP; i<N; i+=2) {
schedule(idx[i],idx[i+1]);
vec.push_back({idx[i], idx[i+1]});
}
vector<int> tmp = visit();
for(int i=0; i<vec.size(); i++) {
if(tmp[i]) swap(idx[vec[i].first], idx[vec[i].second]);
}
}
vector<int>Ans;
for(int i=1; i<=N; i++) Ans.push_back(i);
answer(Ans);
}
