| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1365850 | julia_08 | The Collection Game (BOI21_swaps) | C++20 | 20 ms | 7608 KiB |
#include <bits/stdc++.h>
#include "swaps.h"
using namespace std;
const int MAXN = 510;
bool cmp[MAXN][MAXN];
vector<vector<vector<pair<int, int>>>> comp;
void compute(int l, int r, int d){
int n = (r - l + 1);
if(n == 1) return;
int m = l + (r - l) / 2;
if(n % 2 == 1) l ++;
int sz = r - m;
vector<int> left, right;
for(int i=l; i<=m; i++) left.push_back(i);
for(int i=(m + 1); i<=r; i++) right.push_back(i);
for(int x=0; x<sz; x++){
for(int i=0; i<sz; i++){
comp[d][x].push_back({left[i], right[(i + x) % sz]});
}
}
if(n % 2 == 1){
l --;
for(int i=0; i<sz; i++){
comp[d][sz + i].push_back({l, right[i]});
}
}
compute(l, m, d + 1);
compute(m + 1, r, d + 1);
}
void solve(int n, int v){
comp.resize(n);
for(int i=0; i<n; i++) comp[i].resize(n);
compute(1, n, 0);
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(comp[i][j].empty()) continue;
for(auto [a, b] : comp[i][j]) schedule(a, b);
vector<int> ret = visit();
for(int k=0; k<comp[i][j].size(); k++){
auto [a, b] = comp[i][j][k];
cmp[a][b] = ret[k];
cmp[b][a] = !ret[k];
}
}
}
vector<int> vtx;
for(int i=1; i<=n; i++) vtx.push_back(i);
sort(vtx.begin(), vtx.end(), [&] (int a, int b){
return cmp[a][b];
});
answer(vtx);
}
| # | 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... | ||||
