# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
410872 | 2021-05-23T21:04:09 Z | nichke | Hidden Sequence (info1cup18_hidden) | C++14 | 9 ms | 328 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; i++) { tmp.push_back(0); if (!isSubsequence(tmp)) break; cnt[0]++; } tmp.clear(); for (int i = 0; i < N; i++) { tmp.push_back(1); if (!isSubsequence(tmp)) break; 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); tmp.push_back(bt); 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 | Correct | 1 ms | 200 KB | Output is correct: Maximum length of a query = 5 |
2 | Correct | 2 ms | 200 KB | Output is correct: Maximum length of a query = 6 |
3 | Correct | 1 ms | 200 KB | Output is correct: Maximum length of a query = 5 |
4 | Partially correct | 1 ms | 200 KB | Output is partially correct: Maximum length of a query = 6 |
5 | Partially correct | 1 ms | 200 KB | Output is partially correct: Maximum length of a query = 5 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 6 ms | 200 KB | Output is partially correct: Maximum length of a query = 87 |
2 | Partially correct | 6 ms | 200 KB | Output is partially correct: Maximum length of a query = 96 |
3 | Correct | 9 ms | 328 KB | Output is correct: Maximum length of a query = 96 |
4 | Partially correct | 6 ms | 200 KB | Output is partially correct: Maximum length of a query = 78 |
5 | Correct | 7 ms | 200 KB | Output is correct: Maximum length of a query = 95 |
6 | Correct | 6 ms | 200 KB | Output is correct: Maximum length of a query = 87 |
7 | Partially correct | 6 ms | 200 KB | Output is partially correct: Maximum length of a query = 98 |
8 | Correct | 6 ms | 200 KB | Output is correct: Maximum length of a query = 83 |
9 | Correct | 7 ms | 200 KB | Output is correct: Maximum length of a query = 101 |
10 | Partially correct | 8 ms | 200 KB | Output is partially correct: Maximum length of a query = 101 |
11 | Correct | 8 ms | 292 KB | Output is correct: Maximum length of a query = 96 |
12 | Partially correct | 6 ms | 200 KB | Output is partially correct: Maximum length of a query = 101 |
13 | Correct | 8 ms | 296 KB | Output is correct: Maximum length of a query = 101 |