# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
770094 | 2023-06-30T18:27:36 Z | Andrei | Hidden Sequence (info1cup18_hidden) | C++17 | 7 ms | 304 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; vector <int> aux; int cntPref[2]; int cntSuff[2]; vector <int> ans; vector <int> findSequence(int n) { aux.push_back(1); while(cntSuff[1]<=n/2) { if(isSubsequence(aux)==1) cntSuff[1]++; else break; aux.push_back(1); } if(cntSuff[1]==n/2+1) { aux={0}; while(true) { if(isSubsequence(aux)==1) cntSuff[0]++; else break; aux.push_back(0); } cntSuff[1]=n-cntSuff[0]; } else { cntSuff[0]=n-cntSuff[1]; } while((int)ans.size()<n) { if(cntPref[0]+1+cntSuff[1]<cntPref[1]+1+cntSuff[0]) { aux.clear(); for(int i=1; i<=cntPref[0]+1; i++) aux.push_back(0); for(int i=1; i<=cntSuff[1]; i++) aux.push_back(1); if(isSubsequence(aux)==1) ans.push_back(0); else ans.push_back(1); } else { aux.clear(); for(int i=1; i<=cntPref[1]+1; i++) aux.push_back(1); for(int i=1; i<=cntSuff[0]; i++) aux.push_back(0); if(isSubsequence(aux)==1) ans.push_back(1); else ans.push_back(0); } cntPref[ans.back()]++; cntSuff[ans.back()]--; } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct: Maximum length of a query = 5 |
2 | Correct | 1 ms | 208 KB | Output is correct: Maximum length of a query = 6 |
3 | Correct | 0 ms | 208 KB | Output is correct: Maximum length of a query = 5 |
4 | Correct | 0 ms | 208 KB | Output is correct: Maximum length of a query = 5 |
5 | Correct | 0 ms | 208 KB | Output is correct: Maximum length of a query = 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 304 KB | Output is correct: Maximum length of a query = 83 |
2 | Correct | 3 ms | 300 KB | Output is correct: Maximum length of a query = 90 |
3 | Correct | 4 ms | 208 KB | Output is correct: Maximum length of a query = 96 |
4 | Correct | 4 ms | 300 KB | Output is correct: Maximum length of a query = 77 |
5 | Correct | 4 ms | 208 KB | Output is correct: Maximum length of a query = 95 |
6 | Correct | 3 ms | 304 KB | Output is correct: Maximum length of a query = 87 |
7 | Correct | 7 ms | 208 KB | Output is correct: Maximum length of a query = 97 |
8 | Correct | 4 ms | 208 KB | Output is correct: Maximum length of a query = 83 |
9 | Correct | 5 ms | 208 KB | Output is correct: Maximum length of a query = 101 |
10 | Correct | 6 ms | 208 KB | Output is correct: Maximum length of a query = 100 |
11 | Correct | 5 ms | 208 KB | Output is correct: Maximum length of a query = 96 |
12 | Correct | 5 ms | 208 KB | Output is correct: Maximum length of a query = 100 |
13 | Correct | 4 ms | 296 KB | Output is correct: Maximum length of a query = 101 |