| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1366353 | enzy | The Collection Game (BOI21_swaps) | C++20 | 15 ms | 448 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<bits/stdc++.h>
#include "swaps.h"
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
void solve(int n, int Q){
vector<pii>v[2];
vector<int>val;
for(int i=1;i<=n;i++) val.push_back(i);
for(int i=n;i-1>0;i-=2) v[0].push_back({i-1,i});
for(int i=n-1;i-1>0;i-=2) v[1].push_back({i-1,i});
for(int i=1;i<=500;i++){
for(pii p : v[i%2]) schedule(p.fi,p.se);
vector<int>a=visit();
for(int j=0;j<a.size();j++){
if(!a[j]) swap(val[v[i%2][j].fi],val[v[i%2][j].se]);
}
}
answer(val);
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
