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 "grid.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define fi first
#define se second
#define endl '\n'
#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);(s<e?x++:x--))
#define sz(x) (int) (x).size()
#define all(x) (x).begin(),(x).end()
bool used[55];
std::vector<int> SortDisks(int n) {
	vector<int> res;
	
	rep(test,1,n+1){
		rep(x,0,n) if (!used[x]){
			vector<int> temp={x};
			rep(y,0,n){
				if (!used[y] && y!=x) temp.push_back(y);
			}
			for (auto &it:res) temp.push_back(it);
			
			//for (auto &it:temp) cout<<it<<" ";cout<<endl;
			//cout<<PutDisks(temp)<<endl;
			
			if (PutDisks(temp)==n*2-test){
				res.insert(res.begin(),x);
				used[x]=true;
				break;
			}
		}
	}
	
	//for (auto &it:res) cout<<it<<" ";cout<<endl;
	vector<int> ans(n);
	
	rep(x,0,n){
		ans[res[x]]=x+1;
	}
	
	return 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... |