# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
770079 | Andrei | Hidden Sequence (info1cup18_hidden) | C++17 | 4 ms | 296 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> aux;
int cntPref[2];
int cntSuff[2];
vector <int> ans;
vector <int> findSequence(int n)
{
aux.push_back(1);
while((int)aux.size()<=n)
{
if(isSubsequence(aux)==1)
cntSuff[1]++;
aux.push_back(1);
}
cntSuff[0]=n-cntSuff[1];
while((int)ans.size()<n)
{
if(cntPref[0]+1+cntSuff[1]<cntPref[1]+1+cntSuff[0])
{
aux.clear();
for(int i=1; i<=cntPref[0]+1; i++)
aux.push_back(0);
for(int i=1; i<=cntSuff[1]; i++)
aux.push_back(1);
if(isSubsequence(aux)==1)
ans.push_back(0);
else
ans.push_back(1);
}
else
{
aux.clear();
for(int i=1; i<=cntPref[1]+1; i++)
aux.push_back(0);
for(int i=1; i<=cntSuff[0]; i++)
aux.push_back(1);
if(isSubsequence(aux)==1)
ans.push_back(1);
else
ans.push_back(0);
}
cntPref[ans.back()]++;
cntSuff[ans.back()]--;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |