Submission #167135

#TimeUsernameProblemLanguageResultExecution timeMemory
167135minseo852Combo (IOI18_combo)C++11
0 / 100
26 ms408 KiB
#include <combo.h>
#include<string>
using namespace std;
#define t press
string guess_sequence(int N)
{
	std::string r, p, o = "ABXY";
	int i, j, c;
	r = t("AB") ? t("A") ? "A" : "B" : t("X") ? "X" : "Y";
 	if(N==1)return r;
	for (i = 0; i < 4; i++)if (o[i] == r[0]){ o.erase(o.begin() + i); break; }
	for (int i = 1; i < N - 1;)
	{
		p = r + o[0] + r + o[1] + o[0] + r + o[1] + o[1] + r + o[1] + o[2];
		c = t(p);
		r += o[c == i++ ? 2 : c == i + 1 ? 0 : 1];
	}
 	r+=o[t(r+o[0]+r+o[1])==N?t(r+o[0])==N?0:1:2];
	return r;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:9: warning: unused variable 'j' [-Wunused-variable]
    8 |  int i, j, c;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...