Submission #1038527

#TimeUsernameProblemLanguageResultExecution timeMemory
1038527boyliguanhanCombo (IOI18_combo)C++17
100 / 100
21 ms1828 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string str,buton; if(press("AB")) if(press("A")) str="A",buton="BXY"; else str="B",buton="AXY"; else if(press("X")) str="X",buton="ABY"; else str="Y",buton="ABX"; if(N==1)return str; for(int i=2;i<N;i++){ string str2=str+buton[0]+str+buton[1]+buton[0]+str+buton[1]+buton[1]+str+buton[1]+buton[2]; assert(str2.size()<4*N); int k=press(str2); if(k==str.size())str+=buton[2]; else if(k<str.size()+2) str+=buton[0]; else str+=buton[1]; }; if(press(str+buton[0])==N) str+=buton[0]; else if(press(str+buton[1])==N) str+=buton[1]; else str+=buton[2]; return str; }

Compilation message (stderr)

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from combo.cpp:2:
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |     assert(str2.size()<4*N);
      |            ~~~~~~~~~~~^~~~
combo.cpp:18:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     if(k==str.size())str+=buton[2];
      |        ~^~~~~~~~~~~~
combo.cpp:19:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     else if(k<str.size()+2)
      |             ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...