# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
951957 |
2024-03-23T02:42:26 Z |
koukirocks |
Combo (IOI18_combo) |
C++17 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MAX=2e5+10,P=1e9+7;
const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f;
//
//int press(string s) {
// cout<<s<<"\n"<<flush;
// int x;
// cin>>x;
// return x;
//}
string guess_sequence(int N) {
string now;
string a,b,c,d;
if (press("AB")!=0) {
if (press("A")) a="A",b="B",c="X",d="Y";
else a="B",b="A",c="X",d="Y";
} else {
if (press("X")) a="X",b="B",c="A",d="Y";
else a="Y",b="A",c="B",d="X";
}
now=a;
for (int i=1;i<N-1;i++) {
// cout<<i<<" i\n"<<flush;
string q=now+b+b+now+b+c+now+b+d+now+c;
int ans=press(q);
if (ans==i) now+=d;
else if (ans==i+1) now+=c;
else now+=b;
}
string q=now+b;
if (press(q)==N) return q;
q=now+c;
if (press(q)==N) return q;
return now+d;
}
//int main() {
// speed;
// guess_sequence(5);
// return 0;
//}
Compilation message
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:6: error: 'press' was not declared in this scope
27 | if (press("AB")!=0) {
| ^~~~~
combo.cpp:38:11: error: 'press' was not declared in this scope
38 | int ans=press(q);
| ^~~~~
combo.cpp:44:6: error: 'press' was not declared in this scope
44 | if (press(q)==N) return q;
| ^~~~~
combo.cpp:46:6: error: 'press' was not declared in this scope
46 | if (press(q)==N) return q;
| ^~~~~