Submission #636399

#TimeUsernameProblemLanguageResultExecution timeMemory
636399SonCombo (IOI18_combo)C++14
0 / 100
0 ms208 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence( int N ){ vector < char > V; V.push_back('A'); V.push_back('B'); V.push_back('Y'); V.push_back('X'); string ans = ""; int ab = press("AB"); if ( ab == 2 ){ ans = "AB"; } else if ( ab == 1 ){ ans = "A"; } else { int xy = press("XY"); if ( xy == 2 ){ ans = "XY"; } else { ans = "X"; } } int ch; vector < char > W; for ( int i = 0; i < 4; i++ ){ if ( V[i] == ans[0] ){ ch = i; } else { W.push_back(V[i]); } } while ( ans.size() < N ){ string t = ans + W[0] + W[1]; int p = press(t); if ( p == ans.size() + 2 ){ ans += W[0] + W[1]; } else if ( p == ans.size() + 1 ){ ans += W[0]; } else { ans += W[2]; } } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:37:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |     while ( ans.size() < N ){
      |             ~~~~~~~~~~~^~~
combo.cpp:40:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         if ( p == ans.size() + 2 ){
      |              ~~^~~~~~~~~~~~~~~~~
combo.cpp:42:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |         } else if ( p == ans.size() + 1 ){
      |                     ~~^~~~~~~~~~~~~~~~~
combo.cpp:28:9: warning: variable 'ch' set but not used [-Wunused-but-set-variable]
   28 |     int ch;
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...