# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
67051 | osmanorhan | Hidden Sequence (info1cup18_hidden) | C++17 | 7 ms | 308 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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cassert>
#include <vector>
#define all(x) x.begin() , x.end()
#define fi first
#define se second
#define pb push_back
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#include "grader.h"
using namespace std;
bool asknum( int n, int a ) {
vector<int> v;
if( n <= a/2+1 ) {
for(int i=1;i<=n;i++) v.pb( 1 );
return isSubsequence( v );
} else {
for(int i=n;i<=a;i++) v.pb( 0 );
return !isSubsequence( v );
}
return 0;
}
vector < int > findSequence (int a)
{
int bl = 0, pb = 0;
int wh = a, pw = 0;
while( bl < a && asknum(bl+1,a) ) bl++;
vector < int > ans (a, 0);
for(int i=0;i<a;i++) {
if( !bl || !wh ) {
if( bl ) ans[i] = 1, bl--;
continue;
}
vector<int> v;
if( bl+pw < wh+pb ) {
v.pb( 0 );
for(int j=0;j<pw;j++) v.pb( 0 );
for(int j=0;j<bl;j++) v.pb( 1 );
if( isSubsequence( v ) ) ans[i] = 0;
else ans[i] = 1;
} else {
v.pb( 1 );
for(int j=0;j<pb;j++) v.pb( 1 );
for(int j=0;j<wh;j++) v.pb( 0 );
if( isSubsequence( v ) ) ans[i] = 1;
else ans[i] = 0;
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |