#include <vector>
#include<bits/stdc++.h>
#include "messy.h"
using namespace std;
string s = "";
vector<int> ans(0);
void yay(int l, int r) {
if(l == r) {
return;
}
int m = (l+r)/2;
yay(l,m);
yay(m+1,r);
for(int i = l; i <= m; i++) {
for(int j = 0; j < s.size(); j++) {
if(j >= l && j <= r) {
s[j] = '1';
}
else {
s[j] = '0';
}
}
s[i] = '0';
add_element(s);
}
}
void dude(int l, int r, vector<int> haha) {
if(l == r) {
ans[haha[0]] = l;
return;
}
vector<int> a(0);
vector<int> b(0);
int m = (l+r)/2;
for(int i = 0; i < s.size(); i++) {
s[i] = '0';
}
for(int i = 0; i < haha.size(); i++) {
s[haha[i]] = '1';
}
for(int i = 0; i < haha.size(); i++) {
s[haha[i]] = '0';
if(check_element(s)) {
a.push_back(haha[i]);
}
else {
b.push_back(haha[i]);
}
s[haha[i]] = '1';
}
dude(l,m,a);
dude(m+1,r,b);
}
vector<int> restore_permutation(int n, int w, int r) {
for(int i = 0; i < n; i++) {
s+='1';
ans.push_back(0);
}
yay(0,n-1);
compile_set();
vector<int> wut(0);
for(int i = 0; i < n; i++) {
wut.push_back(i);
}
dude(0,n-1,wut);
return ans;
}
Compilation message
messy.cpp: In function 'void yay(int, int)':
messy.cpp:17:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | for(int j = 0; j < s.size(); j++) {
| ~~^~~~~~~~~~
messy.cpp: In function 'void dude(int, int, std::vector<int>)':
messy.cpp:38:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
38 | for(int i = 0; i < s.size(); i++) {
| ~~^~~~~~~~~~
messy.cpp:41:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
41 | for(int i = 0; i < haha.size(); i++) {
| ~~^~~~~~~~~~~~~
messy.cpp:44:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | for(int i = 0; i < haha.size(); i++) {
| ~~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
n = 8 |
2 |
Correct |
1 ms |
300 KB |
n = 8 |
3 |
Correct |
1 ms |
212 KB |
n = 8 |
4 |
Correct |
1 ms |
212 KB |
n = 8 |
5 |
Correct |
0 ms |
212 KB |
n = 8 |
6 |
Correct |
0 ms |
300 KB |
n = 8 |
7 |
Correct |
0 ms |
296 KB |
n = 8 |
8 |
Correct |
1 ms |
212 KB |
n = 8 |
9 |
Correct |
1 ms |
212 KB |
n = 8 |
10 |
Correct |
1 ms |
212 KB |
n = 8 |
11 |
Correct |
0 ms |
212 KB |
n = 8 |
12 |
Correct |
1 ms |
212 KB |
n = 8 |
13 |
Correct |
0 ms |
212 KB |
n = 8 |
14 |
Correct |
0 ms |
212 KB |
n = 8 |
15 |
Correct |
0 ms |
212 KB |
n = 8 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
296 KB |
n = 32 |
2 |
Correct |
1 ms |
280 KB |
n = 32 |
3 |
Correct |
1 ms |
212 KB |
n = 32 |
4 |
Correct |
1 ms |
296 KB |
n = 32 |
5 |
Correct |
0 ms |
340 KB |
n = 32 |
6 |
Correct |
1 ms |
296 KB |
n = 32 |
7 |
Correct |
0 ms |
212 KB |
n = 32 |
8 |
Correct |
0 ms |
300 KB |
n = 32 |
9 |
Correct |
0 ms |
212 KB |
n = 32 |
10 |
Correct |
0 ms |
212 KB |
n = 32 |
11 |
Correct |
1 ms |
296 KB |
n = 32 |
12 |
Correct |
1 ms |
304 KB |
n = 32 |
13 |
Correct |
0 ms |
212 KB |
n = 32 |
14 |
Correct |
0 ms |
300 KB |
n = 32 |
15 |
Correct |
1 ms |
212 KB |
n = 32 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
300 KB |
n = 32 |
2 |
Correct |
0 ms |
212 KB |
n = 32 |
3 |
Correct |
1 ms |
212 KB |
n = 32 |
4 |
Correct |
1 ms |
212 KB |
n = 32 |
5 |
Correct |
1 ms |
212 KB |
n = 32 |
6 |
Correct |
1 ms |
212 KB |
n = 32 |
7 |
Correct |
1 ms |
212 KB |
n = 32 |
8 |
Correct |
1 ms |
212 KB |
n = 32 |
9 |
Correct |
0 ms |
212 KB |
n = 32 |
10 |
Correct |
1 ms |
292 KB |
n = 32 |
11 |
Correct |
1 ms |
212 KB |
n = 32 |
12 |
Correct |
1 ms |
212 KB |
n = 32 |
13 |
Correct |
1 ms |
300 KB |
n = 32 |
14 |
Correct |
1 ms |
212 KB |
n = 32 |
15 |
Correct |
1 ms |
300 KB |
n = 32 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
n = 128 |
2 |
Correct |
1 ms |
468 KB |
n = 128 |
3 |
Correct |
1 ms |
468 KB |
n = 128 |
4 |
Correct |
1 ms |
468 KB |
n = 128 |
5 |
Correct |
1 ms |
468 KB |
n = 128 |
6 |
Correct |
1 ms |
424 KB |
n = 128 |
7 |
Correct |
1 ms |
428 KB |
n = 128 |
8 |
Correct |
1 ms |
468 KB |
n = 128 |
9 |
Correct |
1 ms |
468 KB |
n = 128 |
10 |
Correct |
1 ms |
424 KB |
n = 128 |
11 |
Correct |
1 ms |
468 KB |
n = 128 |
12 |
Correct |
1 ms |
468 KB |
n = 128 |
13 |
Correct |
1 ms |
468 KB |
n = 128 |
14 |
Correct |
1 ms |
468 KB |
n = 128 |
15 |
Correct |
1 ms |
468 KB |
n = 128 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
424 KB |
n = 128 |
2 |
Correct |
1 ms |
468 KB |
n = 128 |
3 |
Correct |
1 ms |
468 KB |
n = 128 |
4 |
Correct |
1 ms |
468 KB |
n = 128 |
5 |
Correct |
1 ms |
468 KB |
n = 128 |
6 |
Correct |
1 ms |
468 KB |
n = 128 |
7 |
Correct |
1 ms |
468 KB |
n = 128 |
8 |
Correct |
1 ms |
468 KB |
n = 128 |
9 |
Correct |
1 ms |
432 KB |
n = 128 |
10 |
Correct |
1 ms |
428 KB |
n = 128 |
11 |
Correct |
1 ms |
468 KB |
n = 128 |
12 |
Correct |
1 ms |
428 KB |
n = 128 |
13 |
Correct |
1 ms |
468 KB |
n = 128 |
14 |
Correct |
1 ms |
468 KB |
n = 128 |
15 |
Correct |
1 ms |
468 KB |
n = 128 |