이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
using namespace std;
#include <bits/stdc++.h>
#include "messy.h"
vector<int> restore_permutation(int n, int w, int r) {
string db = "";
for(int i = 0; i < n; i++) db += '0';
for(int i = 0; i < n; i++){
db[i] = '1';
// cout << "idedu " << db << endl;
add_element(db);
}
compile_set();
string kolKas(n, '0');
vector<int> ret(n);
srand(time(0));
for(int i = 0; i < n; i++){
vector<int> e;
for(int j = 0; j < n; j++) e.push_back(j);
shuffle(e.begin(), e.end(), default_random_engine(rand()));
for(int j = 0; j < n; j++){
if(kolKas[e[j]] == '1') continue;
auto cp = kolKas;
cp[e[j]] = '1';
bool yra = check_element(cp);
if(yra){
// tada i-asis bitas mapinasi i j
ret[e[j]] = i;
kolKas = cp;
break;
}
}
}
// cout << "ret = ["; for(auto x : ret) cout << x << " "; cout << "]\n";
return ret;
}
# | 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... |