제출 #467787

#제출 시각아이디문제언어결과실행 시간메모리
467787imas_713_a콤보 (IOI18_combo)C++14
30 / 100
57 ms544 KiB
# include <bits/stdc++.h>
using namespace std;
 
# define ll long long
# define ld long double
# define pb push_back
# define pob pop_back
# define mp make_pair
# define fi first
# define se second
# define all(x) x.begin(),x.end() 
# define ts to_string
# define ti(a) atoi(a.c_str())
# define NumAfterDecimalP(x) cout<<setprecision(x)<<fixed
 
const ld pi = 2*acos(0.0);
const ll inf = LLONG_MAX;
const ll mod = 1e9+7;

#include "combo.h"

std::string guess_sequence(int N) {
    string ans;
	ll c1=press("A"),c2=press("B"),c3=press("X");
	bool a=true,b=true,x=true;
	if(c1==1) a=false,ans+="A";
	else if(c2==1) b=false,ans+="B";
	else if(c3==1) x=false,ans+="X";
	else
		ans+="Y";
	for(int i=2; i<=N; i++){
		if(a && b && x){
           ans+="A";
		   ll ch=press(ans);
		   if(ch==i) continue;
		   ans.pop_back();
		   ans+="B";
		   ch=press(ans);
		   if(ch==i) continue;
		   ans.pop_back();
		   ans+="X";
		}
       else if(a && b && !x){
           ans+="A";
		   ll ch=press(ans);
		   if(ch==i) continue;
		   ans.pop_back();
		   ans+="B";
		   ch=press(ans);
		   if(ch==i) continue;
		   ans.pop_back();
		   ans+="Y";
		}
		else if(a && !b && x){
           ans+="A";
		   ll ch=press(ans);
		   if(ch==i) continue;
		   ans.pop_back();
		   ans+="X";
		   ch=press(ans);
		   if(ch==i) continue;
		   ans.pop_back();
		   ans+="Y";
		}
		else{
           ans+="B";
		   ll ch=press(ans);
		   if(ch==i) continue;
		   ans.pop_back();
		   ans+="X";
		   ch=press(ans);
		   if(ch==i) continue;
		   ans.pop_back();
		   ans+="Y";
		}
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...