| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 500417 | hidden1 | Hidden Sequence (info1cup18_hidden) | C++14 | 9 ms | 300 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#ifndef LOCAL
#define cerr if(false) cerr
#endif
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
typedef long long ll;
template<class T, template<class T2, class A=allocator<T2> > class cont> inline ostream &operator <<(ostream &out, const cont<T> &x) { for(const auto &it : x) { out << it << " ";} return out;}
template<class T, template<class T2, class A=allocator<T2> > class cont> inline istream &operator >>(istream &in, cont<T> &x) { for(auto &it : x) { in >> it;} return in;}
template<class T, class T2> inline ostream &operator <<(ostream &out, const pair<T, T2> &x) { out << x.first << " " << x.second; return out;}
template<class T, class T2> inline istream &operator >>(istream &in, pair<T, T2> &x) { in >> x.first >> x.second; return in;}
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;
vector<int> findSequence(int n) {
int ZERO = 0, ONE = 1;
int half = (n / 2) + 1;
vector<int> s = {};
int cntZero = 0, cntOne = 0;
for(cntZero = 0; cntZero < half; cntZero ++) {
s.push_back(0);
if(!isSubsequence(s)) {
break;
}
}
s = {};
for(cntOne = 0; cntOne < half; cntOne ++) {
s.push_back(1);
if(!isSubsequence(s)) {
break;
}
}
if(cntZero > cntOne) {
swap(ZERO, ONE);
swap(cntZero, cntOne);
}
cntOne = n - cntZero;
vector<int> ans;
int nowZero = 0, nowOne = 0;
for(int i = 0; i < n; i ++) {
if(i != 0 && ans.back() == ONE) {
if(nowZero + cntOne - nowOne < nowOne + cntZero - nowZero) {
vector<int> ask = {};
for(int j = 0; j < nowZero + 1; j ++) {ask.push_back(ZERO);}
for(int j = 0; j < cntOne - nowOne; j ++) {ask.push_back(ONE);}
if(!isSubsequence(ask)) {
ans.push_back(ONE);
} else {
ans.push_back(ZERO);
}
} else {
vector<int> ask = {};
for(int j = 0; j < nowOne + 1; j ++) {ask.push_back(ONE);}
for(int j = 0; j < cntZero - nowZero; j ++) {ask.push_back(ZERO);}
if(isSubsequence(ask)) {
ans.push_back(ONE);
} else {
ans.push_back(ZERO);
}
}
} else {
vector<int> ask = {};
for(int j = 0; j < nowZero; j ++) {ask.push_back(ZERO);}
ask.push_back(ONE);
for(int j = 0; j < cntZero - nowZero; j ++) {ask.push_back(ZERO);}
if(isSubsequence(ask)) {
ans.push_back(ONE);
} else {
ans.push_back(ZERO);
}
}
if(ans.back() == ONE) {
nowOne ++;
} else {
nowZero ++;
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
