# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
979053 | PenguinsAreCute | Hidden Sequence (info1cup18_hidden) | C++17 | 4 ms | 692 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;
namespace {int zeroes, n;}
bool sth(int k, int l) {
// k, ones-l
vector<int> v;
if(k+(n-zeroes-l)<=(n/2)) {
for(int i=k+1;i--;) v.push_back(0);
for(int i=n-zeroes-l;i--;) v.push_back(1);
return isSubsequence(v);
} else {
for(int i=l+1;i--;) v.push_back(1);
for(int i=zeroes-k;i--;) v.push_back(0);
return !isSubsequence(v);
}
}
vector<int> findSequence (int N) {
n = N;
vector<int> v((N/2)+1,0);
if(isSubsequence(v)) {
zeroes = N; v.clear();
for(int i=1;i<=(N/2);i++) {v.push_back(1); if(isSubsequence(v)) zeroes = N - i;}
} else {
zeroes = 0; v.clear();
for(int i=1;i<=(N/2);i++) {v.push_back(0); if(isSubsequence(v)) zeroes = i;}
}
vector<int> ans; int l = 0, r = 0;
for(int i=0;i<N;i++) {
if(sth(l,r)) {
ans.push_back(0);
l++;
} else {
ans.push_back(1);
r++;
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |