Submission #101425

#TimeUsernameProblemLanguageResultExecution timeMemory
101425UtahaCombo (IOI18_combo)C++14
5 / 100
3 ms276 KiB
/*input

*/
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=2005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

char c[]={'A','B','X','Y'};
string s[3];

// int press(string s){
// 	cout<<s<<'\n';
// 	int ret;
// 	cin>>ret;
// 	return ret;
// }

string guess_sequence(int n){
	string ans;
	{
		int tmp=press("AB");
		if(tmp){
			int meow=press("A");
			if(meow) ans.pb('A');
			else ans.pb('B');
		}
		else{
			int meow=press("X");
			if(meow) ans.pb('X');
			else ans.pb('Y');
		}
	}
	{
		int pt=0;
		REP(i,4){
			if(c[i]==ans[0]) continue;
			s[pt++].pb(c[i]);
		}
	}
	for(int i=1;i<n-1;i++){
		int tmp=press(ans+s[0]+ans+s[1]+s[0]+ans+s[1]+s[1]+ans+s[1]+s[2]);
		if(tmp==SZ(ans)) ans.pb(s[2][0]);
		else if(tmp==SZ(ans)+1) ans.pb(s[0][0]);
		else ans.pb(s[1][0]);
	}
	if(press(ans+s[0])==SZ(ans)+1) ans=ans+s[0];
	else if(press(ans+s[1])==SZ(ans)+1) ans=ans+s[1];
	else ans=ans+s[2];
	return ans;
}



// int main()
// {
// 	int n;
// 	cin>>n;
// 	guess_sequence(n);
// 	return 0;
// }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...