제출 #148290

#제출 시각아이디문제언어결과실행 시간메모리
148290mosiashvililukaCombo (IOI18_combo)C++14
0 / 100
2 ms216 KiB
#include<bits/stdc++.h>
#include "combo.h"
using namespace std;
int a,b,c,d,e;
string p[5],pas,s,pp[5];
string guess_sequence(int a){
	pp[1]="A";pp[2]="B";pp[3]="X";pp[4]="Y";
	if(press("AB")!=0){
		if(press("A")==0){
			pas+="B";
		}else{
			pas+="A";
		}
	}else{
		if(press("X")==0){
			pas+="Y";
		}else{
			pas+="X";
		}
	}
	c=0;
	for(b=1; b<=4; b++){
		if(pp[b][0]!=pas[0]){
			c++;
			p[c]=pp[b];
		}
	}
	for(b=2; b<=a; b++){
		s=pas+p[1]+pas+p[2]+p[1]+pas+p[2]+p[2]+pas+p[2]+p[3];
		c=press(s);
		if(c==0){
			pas+=p[3];
		}else{
			if(c==pas.size()+1){
				pas+=p[1];
			}else{
				pas+=p[2];
			}
		}
	}
	return pas;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:8: 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(c==pas.size()+1){
      |       ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...