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 <bits/stdc++.h>
#include "swaps.h"
using namespace std;
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define ll long long
ll mod=1000000007;
int inf=1000000007;
ll infl=1000000000000000007;
bool was[507];
void solve(int n,int v)
{
vector<int>ans(n);
for(int i=0;i<n;i++) ans[i]=i+1;
int p=8;
while(v--)
{
memset(was,0,sizeof was);
for(int i=n;i>1;i--)
{
if(was[i]) continue;
int l=p;
while(i-(1<<l)<=0) l--;
schedule(ans[i-(1<<l)-1],ans[i-1]);
was[i-(1<<l)]=1;
}
vector<int>vec=visit();
int it=0;
for(int i=n;i>1;i--)
{
if(was[i]) continue;
int l=p;
while(i-(1<<l)<=0) l--;
if(!vec[it++]) swap(ans[i-(1<<l)-1],ans[i-1]);
}
p--;
if(p==-1) p=8;
}
answer(ans);
}
# | 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... |