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"messy.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> restore_permutation(int N, int W, int R) {
string S(N, '0');
for(int i = 0; i + 1 < N; ++i) {
S[i] = '1';
add_element(S);
}
compile_set();
vector<int> ans(N, -1);
for(int i = 0; i < N; ++i) {
S = string(N, '0');
for(int j = 0; j < i; ++j) S[ans[j]] = '1';
for(int j = 0; j < N; ++j) {
if(S[j] == '1') continue;
S[j] = '1';
if(!check_element(S)) {
S[j] = '0';
continue;
}
ans[i] = j;
break;
}
}
for(int i = 0 ; i < N; ++i) {
if(ans[i] == -1) {
ans[i] = N * (N - 1) / 2;
for(int j = 0; j < N; ++j) {
if(i != j) ans[i] -= ans[j];
}
}
}
vector<int> p(N);
for(int i= 0; i < N; ++i) {
p[ans[i]] = i;
}
return p;
}
# | 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... |