Submission #493165

#TimeUsernameProblemLanguageResultExecution timeMemory
493165aSSSdCombo (IOI18_combo)C++14
100 / 100
32 ms592 KiB
//#pragma GCC optimize("O2,unroll-loops") //#pragma GCC target("avx,avx2") #include <bits/stdc++.h> #include "combo.h" using namespace std; #define pb push_back #define forinc(x,a,b) for(int x=a;x<=b;x++) string LET = "ABXY"; string guess_sequence(int n) { string ret = ""; if(press("AB")) { if(press("A")) ret += "A"; else ret += "B"; } else { if(press("X")) ret += "X"; else ret += "Y"; } if(n ==1 ) return ret; string Char; for(int i=0 ; i < 4 ; i++) if(LET[i] != ret[0]) Char.pb(LET[i]); for(int i=1 ; i < n-1 ; i++) { string t = ret + Char[0] + ret + Char[1] + Char[0] + ret + Char[1] + Char[1] + ret +Char[1] + Char[2]; int val = press(t); if(val == ret.size()) ret+=Char[2]; else if (val == ret.size() +1 ) ret+=Char[0]; else ret += Char[1]; } if(ret.size()!= n) { int val =press(ret + Char[0]); if(val == n) ret += Char[0]; else { val = press(ret + Char[1]); if(val == n) ret+=Char[1]; else ret+=Char[2]; } } return ret; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:36:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         if(val == ret.size()) ret+=Char[2];
      |            ~~~~^~~~~~~~~~~~~
combo.cpp:37:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         else if (val == ret.size() +1 ) ret+=Char[0];
      |                  ~~~~^~~~~~~~~~~~~~~~
combo.cpp:41:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |     if(ret.size()!= n)
      |        ~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...