# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975458 | 2024-05-05T08:26:52 Z | pavement | Hidden Sequence (info1cup18_hidden) | C++17 | 13 ms | 696 KB |
#include "grader.h" #include <bits/stdc++.h> using namespace std; vector<int> findSequence(int N) { int minority; if (isSubsequence(vector<int>(N / 2 + 1, 0))) { minority = 1; } else { minority = 0; } int len = N / 2; for (; len >= 0; len--) { if (isSubsequence(vector<int>(len, minority))) { break; } } if (len == 0) { return vector<int>(N, !minority); } vector<int> ret(N, minority); for (int i = 1; i <= N - len; i++) { int b = i - 1, d = (N - len) - i, lo = 0, hi = N / 2 - d, a = N; while (lo <= hi) { int cur_a = (lo + hi) / 2, cur_c = len - cur_a; vector<int> to_ask(cur_a + d + 1, minority); fill(to_ask.begin() + cur_a, to_ask.end(), !minority); if (isSubsequence(to_ask)) { a = cur_a; lo = cur_a + 1; } else { hi = cur_a - 1; } } lo = 0, hi = N / 2 - b; int c = N; while (lo <= hi) { int cur_c = (lo + hi) / 2, cur_a = len - cur_c; vector<int> to_ask(b + cur_c + 1, minority); fill(to_ask.begin(), to_ask.begin() + b + 1, !minority); if (isSubsequence(to_ask)) { c = cur_c; lo = cur_c + 1; } else { hi = cur_c - 1; } } int x = (a == N / 2 - d || a == N ? len - c : a); ret[x + i - 1] = !minority; } return ret; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct: Maximum length of a query = 5 |
2 | Correct | 1 ms | 512 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 | 1 ms | 344 KB | Output is correct: Maximum length of a query = 4 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 688 KB | Output is correct: Maximum length of a query = 83 |
2 | Correct | 10 ms | 432 KB | Output is correct: Maximum length of a query = 90 |
3 | Correct | 11 ms | 440 KB | Output is correct: Maximum length of a query = 96 |
4 | Correct | 8 ms | 436 KB | Output is correct: Maximum length of a query = 77 |
5 | Correct | 10 ms | 440 KB | Output is correct: Maximum length of a query = 95 |
6 | Correct | 9 ms | 696 KB | Output is correct: Maximum length of a query = 87 |
7 | Correct | 11 ms | 692 KB | Output is correct: Maximum length of a query = 97 |
8 | Correct | 9 ms | 696 KB | Output is correct: Maximum length of a query = 83 |
9 | Correct | 11 ms | 688 KB | Output is correct: Maximum length of a query = 101 |
10 | Correct | 11 ms | 688 KB | Output is correct: Maximum length of a query = 100 |
11 | Correct | 13 ms | 688 KB | Output is correct: Maximum length of a query = 96 |
12 | Correct | 10 ms | 692 KB | Output is correct: Maximum length of a query = 100 |
13 | Correct | 13 ms | 692 KB | Output is correct: Maximum length of a query = 101 |