제출 #466800

#제출 시각아이디문제언어결과실행 시간메모리
466800jazzupCombo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include "combo.h"

std::string guess_sequence(int N){
	std::string p = "";

	p="AB";
	char a[3];
	int m = press(p);
	int c;
	if(m==1){
		c=press("A");
		
		if(c==1){
			a[0]='B';
			a[1]='X';
			a[2]='Y';
			p="A";
		}
		else{
			a[0]='A';
			a[1]='X';
			a[2]='Y';
			p="B";
		}

	}

	else{
		c=press("X");

		if(c==1){
			a[0]='A';
			a[1]='B';
			a[2]='Y';
			p="X";
		}
		else{
			a[0]='A';
			a[1]='B';
			a[2]='X';
			p="Y";
		}
	}

	std::string S;

	for(int i=1;i<N-1;i++){
		S=p;
		S+=a[0];
		S+=a[0];
		S+=p;
		S+=a[0];
		S+=a[1];
		S+=p;
		S+=a[0];
		S+=a[2];
		S+=p;
		S+=a[1];
		c=press(S);
		if(c==p.length()){
			p+=a[2];
		}
		else if(c==p.length()+1){
			p+=a[1];
		}
		else{
			p+=a[0];
		}
	}

	S=p;

	S+=a[0];

	c=press(S);

	if(c==p.length()+1)
		return S;

	else{
		S=p;
		S+=a[1];
		c=press(S);

		if(c==p.length()+1)
			return S;
		else{
			p+=a[2];
			return p;
		}
	}
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:60:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |   if(c==p.length()){
      |      ~^~~~~~~~~~~~
combo.cpp:63:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |   else if(c==p.length()+1){
      |           ~^~~~~~~~~~~~~~
combo.cpp:77:6: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |  if(c==p.length()+1)
      |     ~^~~~~~~~~~~~~~
combo.cpp:85:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   85 |   if(c==p.length()+1)
      |      ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...