제출 #148292

#제출 시각아이디문제언어결과실행 시간메모리
148292mosiashvililuka콤보 (IOI18_combo)C++14
100 / 100
52 ms732 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"; } } if(a==1) return pas; 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==pas.size()){ pas+=p[3]; }else{ if(c==pas.size()+1){ pas+=p[1]; }else{ pas+=p[2]; } } } s=pas+p[1]; if(press(s)==pas.size()+1){ pas+=p[1]; }else{ s=pas+p[2]; if(press(s)==pas.size()+1){ pas+=p[2]; }else{ pas+=p[3]; } } return pas; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   if(c==pas.size()){
      |      ~^~~~~~~~~~~~
combo.cpp:35:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |    if(c==pas.size()+1){
      |       ~^~~~~~~~~~~~~~
combo.cpp:43:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |  if(press(s)==pas.size()+1){
      |     ~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:47:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |   if(press(s)==pas.size()+1){
      |      ~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...