제출 #1138943

#제출 시각아이디문제언어결과실행 시간메모리
1138943why1콤보 (IOI18_combo)C++20
30 / 100
10 ms456 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

string guess_sequence(int n) {
	string ans="";
	vector<char> v={'A','B','X','Y'};
	bool check=false;
	for(int i = 0; i < 3; i++){
		string s="";
		s+=v[i];
		int x=press(s);
		if(x==1){
			ans+=v[i];
			v.erase(v.begin()+i);
			check=true;
			break;
		}
	}
	if(!check){
		ans+=v[3];
		v.pop_back();
	}
	int l=1;
	for(int i = 1; i < n; i++){
		check=false;
		for(int j = 0; j < 2; j++){
			int x=press(ans+v[j]);
			if(x>l){
				check=true;
				ans+=v[j];
				l=x;
				break;
			}
		}
		if(!check){
			ans+=v[2];
			l++;
		}
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...