# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
362010 | 2021-02-01T14:33:12 Z | ogibogi2004 | Hidden Sequence (info1cup18_hidden) | C++14 | 8 ms | 492 KB |
#include<bits/stdc++.h> #include "grader.h" using namespace std; vector < int > findSequence (int N) { vector < int > ans; int cnt0,cnt1=-1,n=N,halfn=n/2+1; vector<int>ivan; for(int i=1;i<=halfn;i++) { ivan.clear(); for(int j=0;j<i;j++) { ivan.push_back(1); } if(!isSubsequence(ivan)) { cnt1=i-1; cnt0=n-cnt1; break; } } if(cnt1==-1) { for(int i=1;i<=halfn;i++) { ivan.clear(); for(int j=0;j<i;j++) { ivan.push_back(0); } if(!isSubsequence(ivan)) { cnt0=i-1; cnt1=n-cnt0; break; } } } while(ans.size()<n) { if(cnt0==0) { ans.push_back(1); cnt1--; continue; } if(cnt1==0) { ans.push_back(0); cnt0--; continue; } vector<int>ivan1,ivan2; for(int i=0;i<ans.size();i++) { if(ans[i]==0)ivan1.push_back(0); else ivan2.push_back(1); } ivan1.push_back(0); ivan2.push_back(1); for(int i=0;i<cnt1;i++)ivan1.push_back(1); for(int i=0;i<cnt0;i++)ivan2.push_back(0); if(ivan1.size()<ivan2.size()) { if(isSubsequence(ivan1)) { ans.push_back(0); cnt0--; } else { ans.push_back(1); cnt1--; } } else { if(isSubsequence(ivan2)) { ans.push_back(1); cnt1--; } else { ans.push_back(0); cnt0--; } } } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct: Maximum length of a query = 5 |
2 | Correct | 1 ms | 364 KB | Output is correct: Maximum length of a query = 6 |
3 | Correct | 1 ms | 364 KB | Output is correct: Maximum length of a query = 5 |
4 | Correct | 1 ms | 364 KB | Output is correct: Maximum length of a query = 5 |
5 | Correct | 1 ms | 364 KB | Output is correct: Maximum length of a query = 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 364 KB | Output is correct: Maximum length of a query = 83 |
2 | Correct | 5 ms | 364 KB | Output is correct: Maximum length of a query = 90 |
3 | Correct | 6 ms | 364 KB | Output is correct: Maximum length of a query = 96 |
4 | Correct | 4 ms | 364 KB | Output is correct: Maximum length of a query = 77 |
5 | Correct | 6 ms | 364 KB | Output is correct: Maximum length of a query = 95 |
6 | Correct | 5 ms | 492 KB | Output is correct: Maximum length of a query = 87 |
7 | Correct | 7 ms | 364 KB | Output is correct: Maximum length of a query = 97 |
8 | Correct | 5 ms | 364 KB | Output is correct: Maximum length of a query = 83 |
9 | Correct | 7 ms | 364 KB | Output is correct: Maximum length of a query = 101 |
10 | Correct | 8 ms | 364 KB | Output is correct: Maximum length of a query = 100 |
11 | Correct | 6 ms | 364 KB | Output is correct: Maximum length of a query = 96 |
12 | Correct | 8 ms | 364 KB | Output is correct: Maximum length of a query = 100 |
13 | Correct | 6 ms | 364 KB | Output is correct: Maximum length of a query = 101 |