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>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << ": " << x << " "
#define nl cout << "\n"
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define per(i, a, b) for(int i = (a); i >= (b); i--)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void add_element(string x);
void compile_set();
bool check_element(string x);
vector<int> restore_permutation(int N, int W, int R){
string s = "";
rep(i, 0, N) s += '0';
rep(i, 0, N){
s[i] = '1';
add_element(s);
}
compile_set();
rep(i, 0, N) s[i] = '0';
vector<int> ans(N, -1);
rep(i, 0, N){
vector<int> q;
rep(j, 0, N){
if(s[j] == '1') continue;
q.pb(j);
}
shuffle(all(q), rng);
for(int j : q){
s[j] = '1';
if(check_element(s)){
ans[j] = i;
break;
}
s[j] = '0';
}
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |