# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1039536 | 12345678 | The Collection Game (BOI21_swaps) | C++17 | 64 ms | 956 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "swaps.h"
#include <bits/stdc++.h>
using namespace std;
const int nx=505;
int vs[nx];
int getmax(vector<int> qrs)
{
while (qrs.size()>1)
{
vector<int> nxt;
if (qrs.size()%2) nxt.push_back(qrs.back()), qrs.pop_back();
for (int i=0; i<qrs.size(); i+=2) schedule(qrs[i], qrs[i+1]);
auto v=visit();
for (int i=0; i<v.size(); i++)
{
if (v[i]) nxt.push_back(qrs[2*i]);
else nxt.push_back(qrs[2*i+1]);
}
qrs=nxt;
}
return qrs[0];
}
void solve(int N, int V) {
vector<int> res;
for (int i=1; i<=N; i++)
{
vector<int> qrs;
for (int j=1; j<=N; j++) if (!vs[j]) qrs.push_back(j);
auto tmp=getmax(qrs);
//cout<<"debug "<<tmp<<'\n';
res.push_back(tmp);
vs[tmp]=1;
}
answer(res);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |