# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
734549 | 2023-05-02T15:39:42 Z | keta_tsimakuridze | Hidden Sequence (info1cup18_hidden) | C++14 | 7 ms | 304 KB |
#include<bits/stdc++.h> #include "grader.h" using namespace std; vector < int > findSequence (int n) { int x = 0; // naklebjer romelic gvxdeba vector<int> v; for(int i = 1; i <= (n / 2) + 1; i++) v.push_back(x); if(isSubsequence(v)) x = 1; int cx = 0; v.clear(); for(int i = 1; i <= (n / 2) + 1; i++) { v.push_back(x); if(!isSubsequence(v)) { cx = i - 1; break; } } int l = 0; vector<int> ans; for(int i = 1; i <= cx; ) { if(l == n - cx) { ++i; ans.push_back(x); continue; } v.clear(); if(i + n - cx - l <= n / 2 + 1) { for(int j = 1; j <= i; j++) v.push_back(x); for(int j = 1; j <= n - cx - l; j++) v.push_back(!x); if(isSubsequence(v)) ++i, ans.push_back(x); else ans.push_back(!x), ++l; } else { for(int j = 1; j <= l +1; j++) v.push_back(!x); for(int j = 1; j <= cx - i + 1; j++) v.push_back(x); if(!isSubsequence(v)) ++i, ans.push_back(x); else ans.push_back(!x), ++l; } } while(l < n - cx) ++l, ans.push_back(!x); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 220 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 | 1 ms | 208 KB | Output is correct: Maximum length of a query = 5 |
4 | Correct | 1 ms | 208 KB | Output is correct: Maximum length of a query = 5 |
5 | Correct | 1 ms | 208 KB | Output is correct: Maximum length of a query = 4 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 208 KB | Output is correct: Maximum length of a query = 83 |
2 | Correct | 5 ms | 304 KB | Output is correct: Maximum length of a query = 90 |
3 | Correct | 5 ms | 208 KB | Output is correct: Maximum length of a query = 96 |
4 | Correct | 3 ms | 208 KB | Output is correct: Maximum length of a query = 77 |
5 | Correct | 5 ms | 208 KB | Output is correct: Maximum length of a query = 95 |
6 | Correct | 4 ms | 208 KB | Output is correct: Maximum length of a query = 87 |
7 | Correct | 5 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 | 3 ms | 296 KB | Output is correct: Maximum length of a query = 101 |
10 | Correct | 5 ms | 208 KB | Output is correct: Maximum length of a query = 100 |
11 | Correct | 4 ms | 300 KB | Output is correct: Maximum length of a query = 96 |
12 | Correct | 4 ms | 208 KB | Output is correct: Maximum length of a query = 100 |
13 | Correct | 7 ms | 208 KB | Output is correct: Maximum length of a query = 101 |