# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
987267 | MateiKing80 | The Collection Game (BOI21_swaps) | C++14 | 1028 ms | 6716 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;
#define pb push_back
#define fr first
#define sc second
#define pii pair<int, int>
void solve(int n, int v)
{
set<pii> inf;
for(int i = 1; i <= n; i ++)
for(int j = i + 1; j <= n; j ++)
inf.insert({i,j});
vector<int> ans(n);
for(int i = 0; i < n; i ++)
ans[i] = i + 1;
for(int i = 0; i < v; i ++)
{
set<int> vis;
set<pii> er;
vector<pii> ins;
for(auto it : inf)
{
int x = it.fr, y = it.sc;
if(!vis.count(x) && !vis.count(y))
{
schedule(ans[x-1], ans[y-1]);
vis.insert(x);
vis.insert(y);
ins.pb({x,y});
er.insert(it);
}
}
for(auto it : er)
inf.erase(it);
vector<int> get = visit();
for(int j = 0; j < get.size(); j ++)
{
int x = ins[j].fr, y = ins[j].sc;
bool val = get[j];
if(!val)
swap(ans[x-1], ans[y-1]);
}
}
answer(ans);
}
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... |