# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
67490 | quoriess | Hidden Sequence (info1cup18_hidden) | C++14 | 12 ms | 580 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"
/*
g++ -Wall -grader.cpp -std=c++11 -c "%f"
* */
using namespace std;
vector<int> mult(int a,int x){
vector<int> ret;
for (int i = 0; i < x; i++)
{
ret.push_back(a);
}
return ret;
}
void yazdir(vector<int> yazi){
for (int i = 0; i < (int)yazi.size(); i++)
{
//cout << yazi[i];
}
//cout <<"\n";
}
vector < int > findSequence (int N)
{
vector < int > ans (N, 0);
int no0=0;
for (int i = 1; i <= N/2+1; i++)
{
if(isSubsequence(mult(0,i)))no0++;
else break;
}
int ntemp=0;
if(no0==N/2+1){
for (int i = 1; i <=N/2 ; i++)
{
if(isSubsequence(mult(1,i)))ntemp++;
else break;
}
no0=N-ntemp;
}
//cout << "no 0: "<<no0<<"\n";
int fazla=0,az=1;
if(N-no0>=no0){
swap(fazla,az);
no0=N-no0;
}
//cout << "fazla: "<<fazla<<"\n";
//cout << "no 0: "<<no0<<"\n";
//cout << "geldi"<<"\n";
int n=N;
int p0=0,t0=(fazla==0?no0:n-no0),p1=0,t1=(fazla==1?no0:n-no0);
vector<int> bitler(n,0);
for (int i = 0; i < n; i++)
{
if(p0+1+t1-p1<=n/2+1){
vector<int> koy;
for (int j = 0; j < p0; j++)
{
koy.push_back(0);
}
koy.push_back(0);
for (int j = 0; j < t1-p1; j++)
{
koy.push_back(1);
}
if(isSubsequence(koy)){
bitler[i]=0;
p0++;
}
else{
bitler[i]=1;
p1++;
}
}
else{
vector<int> koy;
for (int j = 0; j < p1; j++)
{
koy.push_back(1);
}
koy.push_back(1);
for (int j = 0; j < t0-p0; j++)
{
koy.push_back(0);
}
if(isSubsequence(koy)){
bitler[i]=1;
p1++;
}
else{
bitler[i]=0;
p0++;
}
}
}
//son fazlayı çıkarttı
return bitler;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |