| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 930193 | beaboss | 콤보 (IOI18_combo) | C++14 | 15 ms | 2004 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
// Source: https://oj.uz/problem/view/IOI18_combo
//
#include "bits/stdc++.h"
using namespace std;
#define s second
#define f first
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<int> vi;
#define FOR(i, a, b) for (int i = (a); i<b; i++)
bool ckmin(int& a, int b){ return b < a ? a = b, true : false; }
bool ckmax(int& a, int b){ return b > a ? a = b, true : false; }
string guess_sequence(int N) {
int ab = press("AB");
string st = "";
string ad = "";
string doub;
string lst;
vector<string> pr;
string poss = "ABXY";
if (ab) {
if (press("A")) st= "A";
else st="B";
} else {
if (press("X")) st= "X";
else st="Y";
}
if (N == 1) return st;
string pref = st;
for (char a: poss) {
if (a == st[0]) continue;
if (ad == "") ad = a;
else if (pr.size() == 0) {
// cout << 'd' << endl;
for (char b: poss) {
if (b != st[0]) {
string aa = string() + a;
string bb = string() + b;
pr.pb(aa + bb);
// cout << "d" + a + b << endl;
}
}
doub = a;
} else lst = a;
}
// for (auto val: pr) cout << val << endl;
// cout << ad << endl;
// cout << pref << endl;
assert(pr.size() == 3);
FOR(i, 1, N-1) {
string guess;
guess += pref + ad;
for (auto val: pr) guess += pref + val;
// cout << pref << endl;
int here = press(guess);
if (here == pref.size()) pref += lst;
else if (here == pref.size() + 1) pref += ad;
else pref += doub;
}
// cout << pref << endl;
ab = press(pref + doub + pref + lst);
// cout << pref << ab << lst << endl;
if (ab > pref.size()) {
// cout << 'd' << endl;
if (press(pref + doub) > pref.size()) return pref + doub;
else return pref + lst;
} else {
return pref + ad;
}
// return pref;
}
// int main() {
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// }
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
