# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
923206 | Ianis | Hidden Sequence (info1cup18_hidden) | C++17 | 2 ms | 856 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
vector<int> operator+(vector<int> dest, const vector<int> &src) {
for (auto &it : src)
dest.push_back(it);
return dest;
}
vector<int> rev(vector<int> v) {
reverse(all(v));
return v;
}
bool flipped;
int cnt[2], used[2];
vector<int> findSequence(int n) {
vector<int> pref, suff;
if (isSubsequence(vector(n / 2 + 1, 0)))
flipped = true;
for (int i = n / 2; i >= 1; i--) {
if (isSubsequence(vector<int>(i, flipped))) {
cnt[flipped] = i;
break;
}
}
cnt[!flipped] = n - cnt[flipped];
vector<int> ans;
while (int(ans.size()) < n) {
vector<int> s;
if (used[0] + cnt[1] - used[1] < used[1] + cnt[0] - used[0]) {
s = vector<int>(used[0] + 1, 0) + vector<int>(cnt[1] - used[1], 1);
if (isSubsequence(s)) ans.push_back(0);
else ans.push_back(1);
} else {
s = vector<int>(used[1] + 1, 1) + vector<int>(cnt[0] - used[0], 0);
if (isSubsequence(s)) ans.push_back(1);
else ans.push_back(0);
}
used[ans.back()]++;
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |