# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
96483 | 2019-02-09T16:08:16 Z | ASG1065 | Hidden Sequence (info1cup18_hidden) | C++14 | 11 ms | 376 KB |
#include<bits/stdc++.h> #include "grader.h" std::vector <int> findSequence(int n) { std::vector <int> ans; std::vector <int> ones; std::vector<int> zeros; int zeroct; int onect; for (int i = 1; i <= std::floor(n/2)+1; ++i) { zeros.push_back(0); if (!isSubsequence(zeros)) { zeroct=i-1; onect=n-zeroct; break; } ones.push_back(1); if (!isSubsequence(ones)) { onect=i-1; zeroct=n-onect; break; } } int usedzeros = 0; int usedones = 0; for (int i = 0; i < n; ++i) { std::vector<int> guess; if (usedzeros+1+onect-usedones <= usedones+1+zeroct-usedzeros) { for (int j = 0; j < usedzeros+1; ++j) { guess.push_back(0); } for (int j = 0; j < onect-usedones; ++j) { guess.push_back(1); } if (isSubsequence(guess)) { ans.push_back(0); ++usedzeros; } else { ans.push_back(1); ++usedones; } } else { for (int j = 0; j < usedones+1; ++j) { guess.push_back(1); } for (int j = 0; j < zeroct-usedzeros; ++j) { guess.push_back(0); } if (isSubsequence(guess)) { ans.push_back(1); ++usedones; } else { ans.push_back(0); ++usedzeros; } } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct: Maximum length of a query = 5 |
2 | Correct | 2 ms | 376 KB | Output is correct: Maximum length of a query = 6 |
3 | Correct | 2 ms | 376 KB | Output is correct: Maximum length of a query = 5 |
4 | Correct | 2 ms | 292 KB | Output is correct: Maximum length of a query = 5 |
5 | Correct | 2 ms | 248 KB | Output is correct: Maximum length of a query = 4 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 316 KB | Output is correct: Maximum length of a query = 83 |
2 | Correct | 8 ms | 248 KB | Output is correct: Maximum length of a query = 90 |
3 | Correct | 10 ms | 376 KB | Output is correct: Maximum length of a query = 96 |
4 | Correct | 6 ms | 248 KB | Output is correct: Maximum length of a query = 77 |
5 | Correct | 9 ms | 376 KB | Output is correct: Maximum length of a query = 95 |
6 | Correct | 7 ms | 376 KB | Output is correct: Maximum length of a query = 87 |
7 | Correct | 8 ms | 376 KB | Output is correct: Maximum length of a query = 97 |
8 | Correct | 4 ms | 316 KB | Output is correct: Maximum length of a query = 83 |
9 | Correct | 9 ms | 376 KB | Output is correct: Maximum length of a query = 101 |
10 | Correct | 6 ms | 312 KB | Output is correct: Maximum length of a query = 100 |
11 | Correct | 5 ms | 312 KB | Output is correct: Maximum length of a query = 96 |
12 | Correct | 11 ms | 320 KB | Output is correct: Maximum length of a query = 100 |
13 | Correct | 9 ms | 316 KB | Output is correct: Maximum length of a query = 101 |