# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199212 | 2020-01-30T09:47:15 Z | Bagritsevich_Stepan | Hidden Sequence (info1cup18_hidden) | C++14 | 53 ms | 376 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; #define mp make_pair #define pb push_back #define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define pii pair < int, int > #define fs first #define sc second #define getfiles ifstream cin("input.txt"); ofstream cout("output.txt"); #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() typedef long long ll; typedef long double ld; const int INF = 2e9; const ll BIG_INF = 1e18; const ll MOD = 1e9 + 7; const int maxn = 1e5 + 5; vector < int > findSequence(int n) { const int maxlen = n / 2 + 1; int num = 1; vector < int > seq; while (sz(seq) < maxlen && isSubsequence(seq)) seq.pb(num); if (!isSubsequence(seq)) seq.pop_back(); if (sz(seq) == maxlen) { num ^= 1; seq.clear(); while (isSubsequence(seq)) seq.pb(num); seq.pop_back(); } int cnt = 0, cnt_nums = sz(seq); vector < int > res(n, num ^ 1); for (int i = 0; i < cnt_nums; i++) { while (sz(seq) < maxlen && isSubsequence(seq)) { seq.insert(seq.begin(), num ^ 1); cnt++; } if (!isSubsequence(seq)) cnt--; vector < int > rev_seq(i + 1, num); while (sz(rev_seq) < maxlen && isSubsequence(rev_seq)) rev_seq.pb(num ^ 1); if (!isSubsequence(rev_seq)) rev_seq.pop_back(); res[max(cnt, n - cnt_nums - (sz(rev_seq) - (i + 1))) + i] = num; seq.pop_back(); } return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct: Maximum length of a query = 5 |
2 | Incorrect | 5 ms | 256 KB | Output is not correct: The returned sequence does not match the hidden one |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 53 ms | 376 KB | Output is not correct: The returned sequence does not match the hidden one |
2 | Halted | 0 ms | 0 KB | - |