Submission #1015251

#TimeUsernameProblemLanguageResultExecution timeMemory
1015251TroySerCombo (IOI18_combo)C++17
10 / 100
52 ms936 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

string guess_sequence(int N) {
  string currPerm = "ABXY";
  char firsty;
  for (int i = 0; i < currPerm.size(); i++) {
    if (press(currPerm.substr(i,1)) == 1) {
      firsty = currPerm[i];
      break;
    }
  }

  string currString = "";
  currString += firsty;
  for (int i = 1; i < N; i++) {
    for (int i = 0; i < currPerm.size(); i++) {
      if (press(currString + currPerm[i]) == currString.size() + 1) {
        currString += currPerm[i];
        break;
      }
    }
  }
  
  return currString;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |   for (int i = 0; i < currPerm.size(); i++) {
      |                   ~~^~~~~~~~~~~~~~~~~
combo.cpp:18:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for (int i = 0; i < currPerm.size(); i++) {
      |                     ~~^~~~~~~~~~~~~~~~~
combo.cpp:19:43: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |       if (press(currString + currPerm[i]) == currString.size() + 1) {
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...