Submission #1283682

#TimeUsernameProblemLanguageResultExecution timeMemory
1283682muhammad-ahmadCombo (IOI18_combo)C++20
0 / 100
1 ms332 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

string guess_sequence(int n){
	vector<string> b = {"A", "B", "X", "Y"};
	string fi;
	for (int i = 0; i < 4; i++){
		fi = b[i];
		if (i == 3) break;
		int x = press(fi);
		if (x == 1){
			break;
		}
	}
	vector<string> se;
	for (auto i : b){
		if (i != fi) se.push_back(i);
	}
	int lstx = 1;
	string ans;
	for (int i = 0; i < n - 1; i++){
		string q1 = fi + ans + se[0] + fi;
		string q2 = fi + ans + se[1] + fi;
		int x1 = press(q1);
		int x2 = press(q2);
		if (x1 == lstx + 1){
			ans += se[0];
		}
		else if (x2 == lstx + 1){
			ans += se[1];
		}
		else {
			ans += se[2];
		}
		lstx++;
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...