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>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x), end(x)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
const ld eps = 1e-13;
const int mxN = 200000;
#include "messy.h"
/*
vector<int> secret = {5, 3, 1, 4, 7, 6, 0, 2};
set<string> S;
void add_element(string s){
string s2 = s;
fr(i, 0, 8){
s2[i] = s[secret[i]];
}
S.insert(s2);
}
void compile_set(){
}
bool check_element(string s){
return S.find(s) != S.end();
}*/
vector<int> restore_permutation(int n, int w, int r){
string s(n, '0');
fr(i, 0, n){
s[i] = '1';
add_element(s);
}
compile_set();
fr(i, 0, n) s[i] = '0';
vector<int> p(n);
fr(i, 0, n){
string temp = s;
fr(j, 0, n){
if(s[j] == '1') continue;
temp[j] = '1';
bool c = check_element(temp);
if(c == true){
s = temp;
p[j] = i;
break;
}
temp[j] = '0';
}
}
return p;
}/*
int main(){
vector<int> p = restore_permutation(8, 100, 100);
for(auto u : p) cout << u <<' ';
cout<<endl;
}
*/
# | 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... |