Submission #83859

#TimeUsernameProblemLanguageResultExecution timeMemory
83859VasiljkoCombo (IOI18_combo)C++14
100 / 100
58 ms600 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string f="AB"; string s,a; int k=press(f); if(k==2){ s="A";a="BXY"; }else if(k==1){ if(press("A")==1) s="A",a="BXY"; else s="B",a="AXY"; }else{ if(press("X")==1) s="X",a="ABY"; else s="Y",a="ABX"; } for(int i=2;i<=n-1;i++){ string p=s+a[0]+s+a[1]+a[0]+s+a[1]+a[1]+s+a[1]+a[2]; int t=press(p); if(t==s.length()+1){ s=s+a[0]; }else if(t==s.length()+2){ s=s+a[1]; }else{ s=s+a[2]; } } if(n==1)return s; if(press(s+a[0])==s.length()+1)s=s+a[0]; else if(press(s+a[1])==s.length()+1)s=s+a[1]; else s=s+a[2]; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         if(t==s.length()+1){
      |            ~^~~~~~~~~~~~~~
combo.cpp:26:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         }else if(t==s.length()+2){
      |                  ~^~~~~~~~~~~~~~
combo.cpp:35:21: 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(press(s+a[0])==s.length()+1)s=s+a[0];
      |        ~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:36:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     else if(press(s+a[1])==s.length()+1)s=s+a[1];
      |             ~~~~~~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...