Submission #148292

#TimeUsernameProblemLanguageResultExecution timeMemory
148292mosiashvililukaCombo (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; }

Compilation message (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...