Submission #155587

#TimeUsernameProblemLanguageResultExecution timeMemory
155587bukanYohandiCombo (IOI18_combo)C++14
0 / 100
2 ms244 KiB
#include <bits/stdc++.h>
#include "combo.h"

std::string guess_sequence(int N) {
  int coins;
  std::string S = "";
  while(S.length()<N){
  	  coins=press(S+"AB");
	  if(coins>S.length()){
	  	coins=press(S+"A");
	  	if(coins>S.length()) S+="A";
	  	else S+="B";
	  } else {
	  	coins=press(S+"X");
	  	if(coins>S.length()) S+="X";
	  	else S+="Y";
	  }
  }
  return S;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    7 |   while(S.length()<N){
      |         ~~~~~~~~~~^~
combo.cpp:9:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |    if(coins>S.length()){
      |       ~~~~~^~~~~~~~~~~
combo.cpp:11:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     if(coins>S.length()) S+="A";
      |        ~~~~~^~~~~~~~~~~
combo.cpp:15:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     if(coins>S.length()) S+="X";
      |        ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...