# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
410870 | 2021-05-23T21:02:05 Z | nichke | Hidden Sequence (info1cup18_hidden) | C++14 | 6 ms | 200 KB |
#include <bits/stdc++.h> #include <grader.h> using namespace std; bool isSubsequence(vector<int> vi); int cnt[2]; int done[2]; vector<int> findSequence(int N) { vector<int> ans(N); vector<int> tmp; for (int i = 0; i < (N + 1) / 2; i++) { tmp.push_back(0); if (!isSubsequence(tmp)) break; cnt[0]++; } tmp.clear(); for (int i = 0; i < (N + 1) / 2; i++) { tmp.push_back(1); if (!isSubsequence(tmp)) break; cnt[1]++; } if (cnt[0] < cnt[1]) { cnt[1] = N - cnt[0]; } else { cnt[0] = N - cnt[1]; } for (int i = N - 1; i >= 0; i--) { if (!cnt[0]) { ans[i] = 1; cnt[1]--; continue; } if (!cnt[1]) { ans[i] = 0; cnt[0]--; continue; } int bt = 1; if (cnt[0] + done[1] > cnt[1] + done[0]) { bt ^= 1; } tmp.clear(); for (int j = 0; j < cnt[bt ^ 1]; j++) tmp.push_back(bt ^ 1); for (int j = 0; j < done[bt]; j++) tmp.push_back(bt); ans[i] = (!isSubsequence(tmp)) ^ bt; done[ans[i]]++; cnt[ans[i]]--; } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 200 KB | Output is not correct: The returned sequence does not match the hidden one |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 200 KB | Output is not correct: The returned sequence does not match the hidden one |
2 | Halted | 0 ms | 0 KB | - |