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;
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define F0R(i, a) FOR(i, 0, a)
map<string, bool> found;
vector<int> restore_permutation(int _n, int w, int r) {
found.clear();
vector<int> ans;
F0R(i, 7) ans.push_back(i);
string cur, s[]={"11110000", "00110011", "10011001"};
F0R(i, 2) add_element(s[i]);
compile_set();
F0R(i, (1 << 8)-1){
cur = bitset<8>(i).to_string();
found[cur] = check_element(cur);
}
F0R(i, 7){
F0R(j, 7){
bool good = true;
F0R(k, 2){
cur = s[k];
swap(cur[i], cur[j]);
if(!found[cur]){
good = false; break;
}
}
if(good){
swap(ans[i], ans[j]);
return ans;
}
}
}
}
Compilation message (stderr)
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:36:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# | 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... |