#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
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 |
1 |
Correct |
2 ms |
380 KB |
n = 8 |
2 |
Correct |
2 ms |
376 KB |
n = 8 |
3 |
Correct |
2 ms |
376 KB |
n = 8 |
4 |
Correct |
2 ms |
376 KB |
n = 8 |
5 |
Correct |
2 ms |
376 KB |
n = 8 |
6 |
Correct |
2 ms |
376 KB |
n = 8 |
7 |
Correct |
2 ms |
376 KB |
n = 8 |
8 |
Correct |
2 ms |
376 KB |
n = 8 |
9 |
Correct |
2 ms |
376 KB |
n = 8 |
10 |
Correct |
2 ms |
376 KB |
n = 8 |
11 |
Correct |
2 ms |
376 KB |
n = 8 |
12 |
Correct |
2 ms |
356 KB |
n = 8 |
13 |
Correct |
2 ms |
376 KB |
n = 8 |
14 |
Correct |
2 ms |
376 KB |
n = 8 |
15 |
Correct |
2 ms |
380 KB |
n = 8 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
grader returned WA |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
grader returned WA |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
252 KB |
grader returned WA |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
grader returned WA |
2 |
Halted |
0 ms |
0 KB |
- |