제출 #119922

#제출 시각아이디문제언어결과실행 시간메모리
119922Boxworld콤보 (IOI18_combo)C++14
5 / 100
2 ms280 KiB
#include <bits/stdc++.h>
using namespace std;
#include "combo.h"
std::string guess_sequence(int N) {
	string S,a,b,c;
	int tmp=3;
	if (press("AB")>=1){
		if(press("A")==1)tmp=0,S="A",a="B",b="X",c="Y";
		else tmp=1,S="B",a="A",b="X",c="Y";
	}else{
		if(press("X")==1)tmp=2,S="X",a="A",b="B",c="Y";
		else tmp=3,S="Y",a="A",b="B",c="X";
	}
	for (int i=2;i<N;i++){
		string p=S+a+S+b+a+S+b+b+S+b+c;
		int X=press(p);
		if (X==i-1)S+=c;
		else if(X==i)S+=a;
		else S+=b;
	}
	if (press(S+a+S+b)==N){
		if (press(S+a)==N)S+=a;else S+=b;
	}else S+=c;
	return S;
}

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:6: warning: variable 'tmp' set but not used [-Wunused-but-set-variable]
    6 |  int tmp=3;
      |      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...