# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
251913 | dantoh000 | On the Grid (FXCUP4_grid) | C++17 | 0 ms | 384 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 <bits/stdc++.h>
#include "grid.h"
using namespace std;
int ct[1005][1005];
int Q[1005];
int done[1005];
int ans[1005];
int query(int N){
vector<int> res;
for (int i = 0; i < N; i++) res.push_back(Q[i]);
return PutDisks(res);
}
vector<int> SortDisks(int N) {
for (int T = N; T >= 1; T--){
printf("solving %d now\n",T);
int id = 0;
for (int i = 0; i < N; i++) {
if (done[i]) continue;
Q[id++] = i;
}
for (int i = 0; i < 40; i++){
random_shuffle(Q,Q+T);
int X = query(N);
X -= N;
for (int j = 0; j < N; j++){
int Lest = X + (j+1);
ct[Q[j]][Lest+1] = 1;
}
}
int ANS;
for (int i = 0; i < N; i++){
int mxidx = 0;
for (int j = 0; j <= N; j++){
//printf("%d ",ct[i][j]);
if (ct[i][j] == 0) mxidx = j;
}
// printf("\n");
//printf("mxidx for %d = %d\n",i,mxidx);
if (mxidx == T) {
ANS = i;
}
}
int i = ANS;
ans[i] = T;
Q[T-1] = i;
done[i] = 1;
}
vector<int> ret;
for (int i = 0; i < N; i++){
ret.push_back(ans[i]);
}
return ret;
}
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... |