Submission #293823

#TimeUsernameProblemLanguageResultExecution timeMemory
293823SaboonCombo (IOI18_combo)C++17
5 / 100
1 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; map<char,char> mp; string guess_sequence(int n){ string p; if (press("AB") > 0){ if (press("A")) p = "A"; else p = "B"; } else{ if (press("X")) p = "X"; else p = "Y"; } char fi = p[0]; mp['A'] = 'A', mp['B'] = 'B', mp['X'] = 'X', mp['Y'] = 'Y'; mp[fi] = 'A', mp['A'] = fi; for (int i = 1; i < n-1; i++){ string Tmp = (p + mp['B']) + (p+mp['X']+mp['B']) + (p+mp['X']+mp['X']) + (p+mp['X']+mp['Y']); int t = press(Tmp); if (t == p.size()) p += mp['Y']; else if (t == p.size()+1) p += mp['B']; else p += mp['X']; } if (press(p+mp['B']) == n) p += mp['B']; else if (press(p+mp['X']) == n) p += mp['X']; else p += mp['Y']; return p; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   if (t == p.size())
      |       ~~^~~~~~~~~~~
combo.cpp:25:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   else if (t == p.size()+1)
      |            ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...