# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
47202 | 2018-04-29T05:06:40 Z | Kmcode | Hidden Sequence (info1cup18_hidden) | C++14 | 8 ms | 632 KB |
#include "bits/stdc++.h" #include "grader.h" using namespace std; vector<int> calc(vector<int> v, int add,int lim,int n) { vector<pair<int, int> > vv; vector<int> v1; for (int i = v.size(); i >= 0; i--) { vector<int> tmp; tmp = v; int z = 0; while (1) { tmp.insert(tmp.begin() + tmp.size() - i, add); if (tmp.size() > lim) { tmp.pop_back(); break; } if (isSubsequence(tmp)) { } else { tmp.pop_back(); break; } z++; } v1.push_back(z); } int sum = n-v.size(); for (int el : v1) { sum -= el; } int id = max_element(v1.begin(), v1.end()) - v1.begin(); v1[id] += sum; int z = v.size(); for (int i = z; i >= 0; i--) { while (v1[z - i]--) { v.insert(v.begin() + v.size() - i, add); } } return v; } vector<int> findSequence(int N) { vector<int> zero; vector<int> one; for (int i = 0; i < N/2 +1; i++) { zero.push_back(0); one.push_back(1); if (isSubsequence(zero)) { } else{ zero.pop_back(); } if (!isSubsequence(one)) { one.pop_back(); } } while (zero.size() + one.size() < N) { if (zero.size() > one.size()) { zero.push_back(0); } else { one.push_back(1); } } if (one.size() > zero.size()) { return calc(zero, 1, (3 * N) / 4 + 1, N); } else { return calc(one, 0, (3 * N) / 4 + 1, N); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 2 ms | 380 KB | Output is partially correct: Maximum length of a query = 7 |
2 | Partially correct | 2 ms | 380 KB | Output is partially correct: Maximum length of a query = 8 |
3 | Partially correct | 2 ms | 380 KB | Output is partially correct: Maximum length of a query = 7 |
4 | Partially correct | 2 ms | 388 KB | Output is partially correct: Maximum length of a query = 7 |
5 | Partially correct | 2 ms | 412 KB | Output is partially correct: Maximum length of a query = 6 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 6 ms | 444 KB | Output is partially correct: Maximum length of a query = 86 |
2 | Partially correct | 6 ms | 444 KB | Output is partially correct: Maximum length of a query = 92 |
3 | Partially correct | 7 ms | 444 KB | Output is partially correct: Maximum length of a query = 102 |
4 | Partially correct | 5 ms | 452 KB | Output is partially correct: Maximum length of a query = 87 |
5 | Partially correct | 6 ms | 496 KB | Output is partially correct: Maximum length of a query = 102 |
6 | Partially correct | 5 ms | 632 KB | Output is partially correct: Maximum length of a query = 130 |
7 | Partially correct | 7 ms | 632 KB | Output is partially correct: Maximum length of a query = 145 |
8 | Partially correct | 6 ms | 632 KB | Output is partially correct: Maximum length of a query = 97 |
9 | Partially correct | 7 ms | 632 KB | Output is partially correct: Maximum length of a query = 114 |
10 | Partially correct | 8 ms | 632 KB | Output is partially correct: Maximum length of a query = 125 |
11 | Partially correct | 6 ms | 632 KB | Output is partially correct: Maximum length of a query = 97 |
12 | Partially correct | 8 ms | 632 KB | Output is partially correct: Maximum length of a query = 150 |
13 | Partially correct | 7 ms | 632 KB | Output is partially correct: Maximum length of a query = 106 |