# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1034045 | denislav | Hidden Sequence (info1cup18_hidden) | C++17 | 5 ms | 704 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 <iostream>
# include <vector>
# include <algorithm>
# include "grader.h"
//# include "grader.cpp"
using namespace std;
int n;
void print(vector<int> v)
{
for(int x: v) cout<<x;
cout<<"\n";
}
vector < int > findSequence (int N)
{
n=N;
int cnt=0;
vector<int> ans;
for(int i=1;i<=n;i++)
{
ans.push_back(0);
if(!isSubsequence(ans))
{
ans.pop_back();
break;
}
cnt++;
}
//cout<<"Here"<<" "<<cnt<<endl;
for(int i=0;i<=cnt;i++)
{
while(true)
{
int br=0, id=-1;
if(i==0)
{
id=-1;
}
else
{
while(true)
{
id++;
if(ans[id]==0) br++;
if(br==i) break;
}
}
//cout<<i<<" "<<id<<endl;
ans.insert(ans.begin()+id+1,1);
//cout<<"Here"<<endl;
if((int)ans.size()==n+1 or !isSubsequence(ans))
{
ans.erase(ans.begin()+id+1);
//print(ans);
break;
}
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |