제출 #908541

#제출 시각아이디문제언어결과실행 시간메모리
908541dragusanu_rares콤보 (IOI18_combo)C++14
100 / 100
13 ms1968 KiB
#include <iostream> #include "combo.h" using namespace std; #define P press string guess_sequence(int n){ if(n==1){ if(P("X")==1)return "X"; else if(P("Y")==1)return "Y"; else if(P("A")==1)return "A"; else return "B"; } else{ char ch1,a,b,c; string S; if(P("XY")>=1){ if(P("X")==1)ch1='X'; else ch1='Y'; } else{ if(P("A")==1)ch1='A'; else ch1='B'; } S=ch1; if(ch1=='A'){ a='B'; b='X'; c='Y'; } else if(ch1=='B'){ a='A'; b='X'; c='Y'; } else if(ch1=='X'){ a='A'; b='B'; c='Y'; } else{ a='A'; b='B'; c='X'; } while(S.size()<n-1){ string guess=S+b+S+c+a+S+c+b+S+c+c; int x=P(guess)-S.size(); if(x==0)S.push_back(a); else if(x==1)S.push_back(b); else S.push_back(c); } if(P(S+a)==n)return S+a; else if(P(S+b)==n)return S+b; else return S+c; } }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:44:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |         while(S.size()<n-1){
      |               ~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...