# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
493759 | 2021-12-12T20:04:09 Z | Habitus | Hidden Sequence (info1cup18_hidden) | C++14 | 0 ms | 0 KB |
#include "grader.h" #include<bits/stdc++.h> #define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define dec(x, y) fixed << setprecision((y)) << (x) #define xx first #define yy second #define srt(v) sort((v).begin(), (v).end()) #define srtr(v) sort((v).rbegin(), (v).rend()) #define pb push_back #define popb pop_back #define sz(a) (int)(a).size() #define len(a) (int)(a).length() #define mp make_pair using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; bool nasao, nasao1; int d, je, gde[200]; vector<int> findSequence(int N) { d=N/2+1; vector<int> v; for(int i=1; i<=d; i++) { v.pb(1); bool da=isSubsequence(v); if(!da) { je=i-1; nasao=1; break; } } if(!nasao) { v.clear(); for(int i=1; i<=d; i++) { v.pb(0); bool da=isSubsequence(v); if(!da) { je=N-i+1; break; } } } for(int a=0; a<je; a++) { nasao=nasao1=0; for(int i=0; i+je-a<=d; i++) { v.clear(); for(int j=0; j<i; j++) v.pb(0); for(int j=0; j<je-a; j++) v.pb(1); bool da=isSubsequence(v); if(!da) { gde[a]=i+a-1; nasao=1; break; } } if(!nasao) { v.clear(); for(int j=0; j<a; j++) v.pb(1); for(int i=0; i+a+1<=d; i++) { if(i==0) v.pb(1); else v.pb(0); bool da=isSubsequence(v); if(!da) { gde[a]=n-2-je-i+a; nasao1=1; break; } } } if(!nasao1) { gde[a]=d-je+2*a; } } v.resize(N); for(int i=0; i<je; i++) { v[gde[i]]=1; } return v; }