# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95350 | 2019-01-30T14:34:24 Z | dalgerok | Hidden Sequence (info1cup18_hidden) | C++14 | 8 ms | 528 KB |
#include<bits/stdc++.h> #include "grader.h" using namespace std; vector < int > findSequence(int N){ vector < int > ans(N, 0), v0, v1, v; int kol0, kol1, cnt0 = 0, cnt1 = 0; for(int i = 0; i < N; i++){ v0.push_back(0); v1.push_back(1); if(isSubsequence(v0) == false){ kol0 = i; kol1 = N - kol0; break; } else if(isSubsequence(v1) == false){ kol1 = i; kol0 = N - kol1; break; } } for(int i = 0; i < N; i++){ v.clear(); if(cnt0 + 1 + kol1 - cnt1 <= N / 2 + 1){ for(int j = 1; j <= cnt0 + 1; j++){ v.push_back(0); } for(int j = 1; j <= kol1 - cnt1; j++){ v.push_back(1); } if(isSubsequence(v) == true){ cnt0 += 1; ans[i] = 0; } else{ cnt1 += 1; ans[i] = 1; } } else{ for(int j = 1; j <= cnt1 + 1; j++){ v.push_back(1); } for(int j = 1; j <= kol0 - cnt0; j++){ v.push_back(0); } if(isSubsequence(v) == true){ cnt1 += 1; ans[i] = 1; } else{ cnt0 += 1; ans[i] = 0; } } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 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 | 248 KB | Output is correct: Maximum length of a query = 5 |
4 | Correct | 2 ms | 420 KB | Output is correct: Maximum length of a query = 5 |
5 | Correct | 2 ms | 376 KB | Output is correct: Maximum length of a query = 4 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 528 KB | Output is correct: Maximum length of a query = 83 |
2 | Correct | 5 ms | 320 KB | Output is correct: Maximum length of a query = 90 |
3 | Correct | 8 ms | 380 KB | Output is correct: Maximum length of a query = 96 |
4 | Correct | 7 ms | 376 KB | Output is correct: Maximum length of a query = 77 |
5 | Correct | 7 ms | 248 KB | Output is correct: Maximum length of a query = 95 |
6 | Correct | 7 ms | 248 KB | Output is correct: Maximum length of a query = 87 |
7 | Correct | 7 ms | 404 KB | Output is correct: Maximum length of a query = 97 |
8 | Correct | 6 ms | 248 KB | Output is correct: Maximum length of a query = 83 |
9 | Correct | 8 ms | 248 KB | Output is correct: Maximum length of a query = 101 |
10 | Correct | 8 ms | 248 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 | 5 ms | 404 KB | Output is correct: Maximum length of a query = 100 |
13 | Correct | 8 ms | 248 KB | Output is correct: Maximum length of a query = 101 |