# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1142828 | tkm_algorithms | Hidden Sequence (info1cup18_hidden) | C++20 | 2 ms | 416 KiB |
/**
* In the name of Allah
* We are nothing and you're everything
* author: najmuddin
**/
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
//#define int ll
const char nl = '\n';
const int N = 1e5+100;
const int block = 317;
const int cBlocks = N/block+5;
//const int inf = 1e18;
const int mod = 1e9+7;
vector < int > findSequence (int n)
{
int one, zero;
one = zero = 0;
int k = n/2+1;
//bool res;
bool ok = 1;
for (int i = 1; i <= 1000; ++i) {
if (i > k){ok = 0; break;}
vector<int> a;
for (int j = 0; j < i; ++j)a.push_back(0);
bool res = isSubsequence(a);
if (res)zero = i;
else break;
}
if (ok)one = n-zero;
else {
for (int i = 1; i <= 1000; ++i) {
if (i > k){break;}
vector<int> a;
for (int j = 0; j < i; ++j)a.push_back(1);
bool res = isSubsequence(a);
if (res)one = i;
else break;
}
zero = n-one;
}
vector<int> ans;
int x, y;
x = 0, y = 0;
for (int j = 0; j < n; ++j) {
if (x+1+(zero-y) <= k) {
vector<int> a;
for (int i = 0; i < x+1; ++i)a.push_back(1);
for (int i = 0; i < zero-y; ++i)a.push_back(0);
bool res = isSubsequence(a);
if (res)ans.push_back(1), x++;
else ans.push_back(0), y++;
} else {
vector<int> a;
for (int i = 0; i < y+1; ++i)a.push_back(0);
for (int i = 0; i < one-x; ++i)a.push_back(1);
bool res = isSubsequence(a);
if (res)ans.push_back(0), y++;
else ans.push_back(1), x++;
}
}
return ans;
//11001101
//z o
//3 5
//5
//1000
//11000
//0111
//00111
//1110
//11110
//0001
//00001
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |