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 <vector>
#include "messy.h"
#include <iostream>
using namespace std;
vector<int> restore_permutation(int n, int w, int r) {
vector<string> s(n);
for(int i=0; i<n; i++) {
for(int j=0; j<n; j++)
(i%2==0)? s[i].push_back('0') : s[i].push_back('1');
for(int j=0; j<=i; j++)
(i%2==0)? s[i][j] = '1' : s[i][j] = '0';
add_element(s[i]);
}
compile_set();
vector<int> ans(n);
for(int i=0; i<n; i++) ans[i] = i;
bool flag = false;
for(int i=0; i<n; i++) {
for(int j=i+1; j<n; j++) {
swap(s[i][i], s[i][j]);
if(check_element(s[i])) {
swap(ans[i], ans[j]);
flag = true;
break;
}
swap(s[i][i], s[i][j]);
}
if(flag) break;
}
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... |