# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
923288 | vjudge1 | Hidden Sequence (info1cup18_hidden) | C++17 | 0 ms | 0 KiB |
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>
#include "grader.h"
using namespace std;
vector<int>findSequence(int n){
map<set<string>,string>cnt;
for(int i=0;i<(1<<n);i++){
string s="";
for(int j=0;j<n;j++){
if((i>>j)&1){
s+='1';
}else{
s+='0';
}
}
set<string>e;
for(int r=(n/2+1);r<=(n/2+1);r++){
for(int k=0;k<(1<<(r));k++){
string t="";
for(int j=0;j<(r);j++){
if((k>>j)&1){
t+='1';
}else{
t+='0';
}
}
int p=0;
for(auto u:s){
if(p<t.size() and u==t[p]){
p++;
}
}
if(p==t.size()){
e.insert(t);
}
}
}
cnt[e]=s;
}
set<vector<int>>e;
for(int r=(n/2+1);r<=(n/2+1);r++){
for(int k=0;k<(1<<(r));k++){
vector<int>t;
for(int j=0;j<(r);j++){
if((k>>j)&1){
t.push_back(1);
}else{
t.push_back(0);
}
}
if(isSubsequence(t)){
e.insert(t);
}
}
}
vector<int>ans;
for(auto u:cnt[e]){
ans.push_back(u-'0');
}
return ans;
}