Submission #123058

#TimeUsernameProblemLanguageResultExecution timeMemory
123058khulegub콤보 (IOI18_combo)C++14
5 / 100
2 ms276 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string butt[] = {"A", "B", "X", "Y"}; string guess_sequence(int n) { int f; string s = ""; if(press("A")) f = 0; else if(press("B")) f = 1; else if(press("X")) f = 2; else f = 3; s = butt[f]; string asky = s + butt[(f + 1) % 4]; asky += s + butt[(f + 2) % 4] + butt[(f + 1) % 4]; asky += s + butt[(f + 2) % 4] + butt[(f + 2) % 4]; asky += s + butt[(f + 2) % 4] + butt[(f + 3) % 4]; for (int i = 1; i < n - 1; i++){ int x = press(asky); int nxt; if (x == s.length() + 1) nxt = (f + 1) % 4; else if (x == s.length() + 2) nxt = (f + 2) % 4; else if (x == s.length() ) nxt = (f + 3) % 4; s += butt[nxt]; } if(press(s + "A") == s.length() + 1 ) return s + "A"; if(press(s + "B") == s.length() + 1 ) return s + "B"; if(press(s + "X") == s.length() + 1 ) return s + "X"; return s + "Y"; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:9: 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 (x == s.length() + 1) nxt = (f + 1) % 4;
      |       ~~^~~~~~~~~~~~~~~~~
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 (x == s.length() + 2) nxt = (f + 2) % 4;
      |            ~~^~~~~~~~~~~~~~~~~
combo.cpp:26:14: 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 (x == s.length() ) nxt = (f + 3) % 4;
      |            ~~^~~~~~~~~~~~~
combo.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  if(press(s + "A") == s.length() + 1 ) return s + "A";
      |     ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:30:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |  if(press(s + "B") == s.length() + 1 ) return s + "B";
      |     ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:31:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  if(press(s + "X") == s.length() + 1 ) return s + "X";
      |     ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...