# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
408741 | 2021-05-19T15:07:47 Z | Atill83 | Hidden Sequence (info1cup18_hidden) | C++14 | 146 ms | 296 KB |
#include<bits/stdc++.h> #include "grader.h" using namespace std; vector<int> findSequence(int n){ vector<int> sorg((n + 1) / 2, 0); int less = 0; if(isSubsequence(sorg)){ less = 1; } int idx = 0; while(idx <= (n + 1) / 2 && isSubsequence(vector<int>(idx, less))) idx++; idx--; vector<int> say(2, 0); say[less] = idx; say[!less] = n - idx; vector<int> onc(idx + 1, 0); for(int i = 1; i <= say[less]; i++){ vector<int> srg; for(int j = 0; j < i; j++) srg.push_back(less); bool done = 0; int mx = 0; for(int j = 1; (j + i) <= n / 2 + 1; j++){ srg.push_back(!less); if(!isSubsequence(srg)){ done = 1; mx = j - 1; break; } } if(done){ onc[i] = say[!less] - mx; }else{ mx = 0; for(int j = 0; (j + say[less] - i + 1) <= n / 2 + 1; j++){ mx = j; srg.clear(); for(int l = 0; l < j; l++) srg.push_back(!less); for(int l = 0; l < say[less] - i + 1; l++) srg.push_back(less); if(!isSubsequence(srg)){ done = 1; mx = j - 1; break; } } onc[i] = mx; } } vector<int> ans; int ot = 0; for(int i = 1; i <= idx; i++){ while(ot < onc[i]){ ans.push_back(!less); ot++; } ans.push_back(less); } while(ot < say[!less]){ ot++; ans.push_back(!less); } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 200 KB | Output is correct: Maximum length of a query = 5 |
2 | Correct | 1 ms | 200 KB | Output is correct: Maximum length of a query = 6 |
3 | Correct | 1 ms | 200 KB | Output is correct: Maximum length of a query = 5 |
4 | Correct | 1 ms | 200 KB | Output is correct: Maximum length of a query = 5 |
5 | Correct | 1 ms | 200 KB | Output is correct: Maximum length of a query = 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 36 ms | 276 KB | Output is correct: Maximum length of a query = 83 |
2 | Correct | 62 ms | 200 KB | Output is correct: Maximum length of a query = 90 |
3 | Correct | 91 ms | 292 KB | Output is correct: Maximum length of a query = 96 |
4 | Correct | 44 ms | 200 KB | Output is correct: Maximum length of a query = 77 |
5 | Correct | 103 ms | 292 KB | Output is correct: Maximum length of a query = 95 |
6 | Correct | 46 ms | 200 KB | Output is correct: Maximum length of a query = 87 |
7 | Correct | 130 ms | 292 KB | Output is correct: Maximum length of a query = 97 |
8 | Correct | 101 ms | 276 KB | Output is correct: Maximum length of a query = 83 |
9 | Correct | 98 ms | 296 KB | Output is correct: Maximum length of a query = 101 |
10 | Correct | 83 ms | 292 KB | Output is correct: Maximum length of a query = 100 |
11 | Correct | 73 ms | 200 KB | Output is correct: Maximum length of a query = 96 |
12 | Correct | 72 ms | 288 KB | Output is correct: Maximum length of a query = 100 |
13 | Correct | 146 ms | 200 KB | Output is correct: Maximum length of a query = 101 |