Submission #445360

#TimeUsernameProblemLanguageResultExecution timeMemory
445360silverfishCombo (IOI18_combo)C++14
30 / 100
52 ms448 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back


string guess_sequence(int n) {
	string ans="";
	vector<char> c, cc = {'A', 'B', 'X', 'Y'};
	bool found = 0;

	for(int i = 0; i < 3; ++i){
		if(press(ans+cc[i])){
			ans.pb(cc[i]);	
			for(char cch : cc) 
				if(cch != cc[i]) c.pb(cch);
			found = 1;
			break;
		}
	}
	if(!found){
		ans.pb(cc[3]);
		for(char cch : cc) 
			if(cch != cc[3]) c.pb(cch);
	}

	for(int i = 1; i < n; ++i){
		found = 0;
		for(int j = 0; j < 2; ++j){
			if(press(ans + c[j]) == i+1){
				found = 1;
				ans.pb(c[j]);
				break;
			}
		}
		if(!found) ans.pb(c[2]);
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...