# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
847998 | 2023-09-11T00:48:14 Z | Charizard2021 | Hidden Sequence (info1cup18_hidden) | C++17 | 4 ms | 692 KB |
#include<bits/stdc++.h> #include "grader.h" using namespace std; vector<int> findSequence(int n){ vector<int> v1; vector<int> v2; int idx1 = 0; int idx2 = 0; while(true){ v1.push_back(0); v2.push_back(1); if(isSubsequence(v1)){ idx1++; } else{ idx2 = n - idx1; break; } if(isSubsequence(v2)){ idx2++; } else{ idx1 = n - idx2; break; } } int val1 = idx1; int val2 = idx2; vector<int> ans(n, 0); for(int i = 0; i < n; i++){ if(val1 == 0){ for(int j = i; j < n; j++){ ans[j] = 1; } break; } if(val2 == 0){ for(int j = i; j < n; j++){ ans[j] = 0; } break; } v1.clear(); v2.clear(); for(int j = 0; j < idx1 - val1 + 1; j++){ v1.push_back(0); } for(int j = 0; j < val2; j++){ v1.push_back(1); } for(int j = 0; j < idx2 - val2 + 1; j++){ v2.push_back(1); } for(int j = 0; j < val1; j++){ v2.push_back(0); } if(v1.size() <= (n / 2 + 1)){ if(isSubsequence(v1)){ ans[i] = 0; val1--; } else{ ans[i] = 1; val2--; } } else{ if(isSubsequence(v2)){ ans[i] = 1; val2--; } else{ ans[i] = 0; val1--; } } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct: Maximum length of a query = 5 |
2 | Correct | 0 ms | 344 KB | Output is correct: Maximum length of a query = 6 |
3 | Correct | 0 ms | 344 KB | Output is correct: Maximum length of a query = 5 |
4 | Correct | 0 ms | 344 KB | Output is correct: Maximum length of a query = 5 |
5 | Correct | 0 ms | 344 KB | Output is correct: Maximum length of a query = 4 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 436 KB | Output is correct: Maximum length of a query = 83 |
2 | Correct | 3 ms | 436 KB | Output is correct: Maximum length of a query = 90 |
3 | Correct | 4 ms | 688 KB | Output is correct: Maximum length of a query = 96 |
4 | Correct | 2 ms | 436 KB | Output is correct: Maximum length of a query = 77 |
5 | Correct | 3 ms | 436 KB | Output is correct: Maximum length of a query = 95 |
6 | Correct | 3 ms | 692 KB | Output is correct: Maximum length of a query = 87 |
7 | Correct | 3 ms | 432 KB | Output is correct: Maximum length of a query = 97 |
8 | Correct | 3 ms | 436 KB | Output is correct: Maximum length of a query = 83 |
9 | Correct | 4 ms | 688 KB | Output is correct: Maximum length of a query = 101 |
10 | Correct | 4 ms | 692 KB | Output is correct: Maximum length of a query = 100 |
11 | Correct | 4 ms | 684 KB | Output is correct: Maximum length of a query = 96 |
12 | Correct | 3 ms | 688 KB | Output is correct: Maximum length of a query = 100 |
13 | Correct | 4 ms | 692 KB | Output is correct: Maximum length of a query = 101 |