# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
973650 | 2024-05-02T09:00:18 Z | penguin133 | Hidden Sequence (info1cup18_hidden) | C++17 | 5 ms | 700 KB |
#include <bits/stdc++.h> using namespace std; #include "grader.h" //#define int long long #define pi pair<int, int> #define pii pair<int, pi> #define fi first #define se second #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #endif mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); vector < int > findSequence (int N) { vector <int> x; for(int i = 0; i < N / 2 + 1; i++)x.push_back(0); if(isSubsequence(x)){ int ones = 0; while(1){ x.clear(); for(int i = 0; i < ones + 1; i++)x.push_back(1); if(isSubsequence(x))ones++; else break; } vector <int> ans; int num0 = 0, num1 = 0; for(int i = 0; i < ones; i++){ int zrs = 0; while(1){ vector <int> qry; if(num1 < num0)for(int j = 0; j < i; j++)qry.push_back(1); else { for(int j = 0; j < num0; j++)qry.push_back(0); } for(int j = 0; j < zrs + 1; j++)qry.push_back(0); for(int j = 0; j < ones - i; j++)qry.push_back(1); if(qry.size() <= N && isSubsequence(qry))zrs++; else break; } for(int j = 0; j < zrs; j++)ans.push_back(0); ans.push_back(1); num0 += zrs; num1 += 1; } while(ans.size() < N)ans.push_back(0); return ans; } else{ int ones = 0; while(1){ x.clear(); for(int i = 0; i < ones + 1; i++)x.push_back(0); if(isSubsequence(x))ones++; else break; } vector <int> ans; int num0 = 0, num1 = 0; for(int i = 0; i < ones; i++){ int zrs = 0; while(1){ vector <int> qry; if(num1 < num0)for(int j = 0; j < num1; j++)qry.push_back(1); else { for(int j = 0; j < num0; j++)qry.push_back(0); } for(int j = 0; j < zrs + 1; j++)qry.push_back(1); for(int j = 0; j < ones - i; j++)qry.push_back(0); if(qry.size() <= N && isSubsequence(qry))zrs++; else break; } for(int j = 0; j < zrs; j++)ans.push_back(1); ans.push_back(0); num0++; num1 += zrs; } while(ans.size() < N)ans.push_back(1); return ans; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 344 KB | Output is partially correct: Maximum length of a query = 6 |
2 | Partially correct | 1 ms | 344 KB | Output is partially correct: Maximum length of a query = 8 |
3 | Partially correct | 0 ms | 344 KB | Output is partially correct: Maximum length of a query = 6 |
4 | Correct | 0 ms | 344 KB | Output is correct: Maximum length of a query = 5 |
5 | Partially correct | 0 ms | 344 KB | Output is partially correct: Maximum length of a query = 6 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 4 ms | 440 KB | Output is partially correct: Maximum length of a query = 86 |
2 | Partially correct | 3 ms | 696 KB | Output is partially correct: Maximum length of a query = 92 |
3 | Partially correct | 4 ms | 700 KB | Output is partially correct: Maximum length of a query = 99 |
4 | Partially correct | 3 ms | 440 KB | Output is partially correct: Maximum length of a query = 82 |
5 | Partially correct | 4 ms | 436 KB | Output is partially correct: Maximum length of a query = 101 |
6 | Partially correct | 3 ms | 440 KB | Output is partially correct: Maximum length of a query = 100 |
7 | Partially correct | 3 ms | 692 KB | Output is partially correct: Maximum length of a query = 128 |
8 | Partially correct | 2 ms | 432 KB | Output is partially correct: Maximum length of a query = 111 |
9 | Partially correct | 3 ms | 436 KB | Output is partially correct: Maximum length of a query = 126 |
10 | Partially correct | 3 ms | 440 KB | Output is partially correct: Maximum length of a query = 124 |
11 | Correct | 3 ms | 600 KB | Output is correct: Maximum length of a query = 96 |
12 | Partially correct | 3 ms | 692 KB | Output is partially correct: Maximum length of a query = 150 |
13 | Partially correct | 5 ms | 440 KB | Output is partially correct: Maximum length of a query = 105 |