제출 #140776

#제출 시각아이디문제언어결과실행 시간메모리
140776caoash콤보 (IOI18_combo)C++14
5 / 100
2 ms256 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

string guess_sequence(int N){
	string soFar;
	string first = "A";
	if(press("B")){
		first = "B";
	}
	else if(press("Y")){
		first = "Y";
	}
	else if(press("X")){
		first = "X";
	}
	soFar += first;
	string c1,c2,c3;
	if(first == "A"){
		c1 = "X"; c2 = "Y"; c3 = "B";
	}
	else if(first == "B"){
		c1 = "X"; c2 = "Y"; c3 = "A";
	}
	else if(first == "X"){
		c1 = "B"; c2 = "Y"; c3 = "A";
	}
	else if(first == "Y"){
		c1 = "X"; c2 = "B"; c3 = "A";
	}
	for(int i = 1; i < N-1; i++){
		int val = press(soFar + c1 + c1 + soFar + c1 + c2 + soFar + c1 + c3 + soFar + c2);
		if(val == soFar.size()){
			soFar += c3;
		}
		else if(val == soFar.size()+1){
			soFar += c2;
		}
		else{
			soFar += c1;
		}
	}
	if (press(soFar + c1 + soFar + c2) == N) {
		if (press(soFar + c1) == N) soFar += c1;
		else soFar += c2;
	} else soFar += c3;
	return soFar;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   if(val == soFar.size()){
      |      ~~~~^~~~~~~~~~~~~~~
combo.cpp:37:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   else if(val == soFar.size()+1){
      |           ~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...