# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
598408 | 2022-07-18T09:38:50 Z | alextodoran | Hidden Sequence (info1cup18_hidden) | C++17 | 7 ms | 308 KB |
/** ____ ____ ____ ____ ____ ||a |||t |||o |||d |||o || ||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\| **/ #include <bits/stdc++.h> #include "grader.h" using namespace std; typedef long long ll; bool isSubsequence (vector <int> v); vector <int> findSequence (int N) { int suff[2]; { if (isSubsequence(vector <int> (N / 2 + 1, 0)) == false) { suff[0] = 0; while (isSubsequence(vector <int> (suff[0] + 1, 0)) == true) { suff[0]++; } suff[1] = N - suff[0]; } else { suff[1] = 0; while (isSubsequence(vector <int> (suff[1] + 1, 1)) == true) { suff[1]++; } suff[0] = N - suff[1]; } } int pref[2]; pref[0] = pref[1] = 0; vector <int> v; while ((int) v.size() < N) { if (pref[0] + 1 + suff[1] < pref[1] + 1 + suff[0]) { vector <int> ask; for (int i = 0; i < pref[0]; i++) { ask.push_back(0); } ask.push_back(0); for (int i = 0; i < suff[1]; i++) { ask.push_back(1); } if (isSubsequence(ask) == true) { v.push_back(0); } else { v.push_back(1); } } else { vector <int> ask; for (int i = 0; i < pref[1]; i++) { ask.push_back(1); } ask.push_back(1); for (int i = 0; i < suff[0]; i++) { ask.push_back(0); } if (isSubsequence(ask) == true) { v.push_back(1); } else { v.push_back(0); } } pref[v.back()]++; suff[v.back()]--; } return v; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 292 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 | 0 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 | 0 ms | 208 KB | Output is correct: Maximum length of a query = 4 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 208 KB | Output is correct: Maximum length of a query = 83 |
2 | Correct | 4 ms | 304 KB | Output is correct: Maximum length of a query = 90 |
3 | Correct | 6 ms | 208 KB | Output is correct: Maximum length of a query = 96 |
4 | Correct | 4 ms | 208 KB | Output is correct: Maximum length of a query = 77 |
5 | Correct | 7 ms | 304 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 | 4 ms | 208 KB | Output is correct: Maximum length of a query = 97 |
8 | Correct | 3 ms | 208 KB | Output is correct: Maximum length of a query = 83 |
9 | Correct | 5 ms | 300 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 | 208 KB | Output is correct: Maximum length of a query = 96 |
12 | Correct | 6 ms | 208 KB | Output is correct: Maximum length of a query = 100 |
13 | Correct | 5 ms | 308 KB | Output is correct: Maximum length of a query = 101 |