# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
877536 | AndrijaM | Art Collections (BOI22_art) | C++17 | 0 ms | 344 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 "art.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
const int mod = 1e9+7;
const int logn=30;
void solve(int n)
{
vector<int>v;
for(int i=0;i<n;i++)
{
v.push_back(i+1);
}
int prev=publish(v);
int p=1;
swap(v[0],v[1]);
for(int i=0;i<n;i++)
{
while(true)
{
int kolku=publish(v);
if(kolku==0)
{
answer(v);
}
if(kolku>prev)
{
swap(v[i],v[p]);
break;
}
int koj=v[i]+1;
int P=-1;
for(int pos=0;pos<v.size();pos++)///moze i so mapa da najdeme kade e vo log(n)
{
if(v[pos]==koj)
{
P=pos;
break;
}
}
p=P;
swap(v[i],v[P]);
}
}
answer(v);
/// publish(order);
/// answer(order);
}
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... |