# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
973503 | 2024-05-02T05:55:25 Z | shoryu386 | 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){ int A = 1, B = 0; vector<int> test; int numA = 0; for (int x = 1; x <= N/2+1; x++){ test.push_back(A); if (isSubsequence(test)){ numA++; } else break; } if (numA >= N/2+1){ swap(A, B); numA = 0; test.clear(); for (int x = 1; x <= N/2+1; x++){ test.push_back(A); if (isSubsequence(test)){ numA++; } else break; } } int filler[numA+1]; memset(filler, 0, sizeof(filler)); test.clear(); int cap = N/4 + 1; int marker = -1; for (int x = 0; x <= numA; x++){ while (true){ filler[x]++; test.clear(); if (marker == -1 && filler[x] > cap){ filler[x] = 0; marker = x; //cerr << "Marked " << x << "!\n"; break; } for (int y = 0; y < x; y++){ test.push_back(A); } for (int y = 0; y < filler[x]; y++){ test.push_back(B); } for (int y = 0; y < numA - x; y++){ test.push_back(A); } if (test.size() <= N && isSubsequence(test)){ continue; } else {filler[x]--; break;} } } int numB = N-numA; if (marker != -1){ int cursum = 0; for (int x = 0; x <= numA; x++){ cursum += filler[x]; } filler[marker] = numB - cursum; } test.clear(); for (int y = 0; y < numA; y++){ for (int z = 0; z < filler[y]; z++){ test.push_back(B); } test.push_back(A); } for (int z = 0; z < filler[numA]; z++){ test.push_back(B); } return test; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 344 KB | Output is partially correct: Maximum length of a query = 7 |
2 | Partially correct | 0 ms | 344 KB | Output is partially correct: Maximum length of a query = 8 |
3 | Partially correct | 0 ms | 344 KB | Output is partially correct: Maximum length of a query = 7 |
4 | Partially correct | 0 ms | 344 KB | Output is partially correct: Maximum length of a query = 7 |
5 | Partially correct | 1 ms | 344 KB | Output is partially correct: Maximum length of a query = 6 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 2 ms | 436 KB | Output is partially correct: Maximum length of a query = 86 |
2 | Partially correct | 3 ms | 436 KB | Output is partially correct: Maximum length of a query = 92 |
3 | Partially correct | 3 ms | 692 KB | Output is partially correct: Maximum length of a query = 102 |
4 | Partially correct | 3 ms | 688 KB | Output is partially correct: Maximum length of a query = 87 |
5 | Partially correct | 3 ms | 688 KB | Output is partially correct: Maximum length of a query = 102 |
6 | Partially correct | 2 ms | 436 KB | Output is partially correct: Maximum length of a query = 130 |
7 | Partially correct | 4 ms | 692 KB | Output is partially correct: Maximum length of a query = 144 |
8 | Partially correct | 3 ms | 432 KB | Output is partially correct: Maximum length of a query = 97 |
9 | Partially correct | 3 ms | 436 KB | Output is partially correct: Maximum length of a query = 114 |
10 | Partially correct | 4 ms | 688 KB | Output is partially correct: Maximum length of a query = 125 |
11 | Partially correct | 3 ms | 432 KB | Output is partially correct: Maximum length of a query = 97 |
12 | Partially correct | 4 ms | 688 KB | Output is partially correct: Maximum length of a query = 150 |
13 | Partially correct | 3 ms | 436 KB | Output is partially correct: Maximum length of a query = 106 |