| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 527513 | beepbeepsheep | On the Grid (FXCUP4_grid) | C++17 | 12 ms | 332 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 "grid.h"
#include <bits/stdc++.h>
using namespace std;
#define ll int
std::vector<int> SortDisks(int n) {
	vector<int> v,ans(n);
	int chk[n];
	memset(chk,-1,sizeof(chk));
	for (int i=0;i<n;i++){
        v.push_back(i);
	}
	ll a=PutDisks(v),b;
	vector<int> w;
	while (v.size()){
        w.clear();
        ll t=v.back(),p=0;
        for (int i=v.size()-1;i>0;i--) swap(v[i],v[i-1]);
        for (int i=0;i<n;i++){
            if (chk[i]!=-1) w.push_back(chk[i]);
            else w.push_back(v[p++]);
        }
        b=PutDisks(w);
        if (b>a-1){
            t=v[0];
            ans[t]=b-(n-1);
            chk[ans[t]-1]=t;
            for (int i=0;i<v.size()-1;i++) swap(v[i],v[i+1]);
            v.pop_back();
        } else a=b;
	}
	return 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... | ||||
