Submission #1015233

#TimeUsernameProblemLanguageResultExecution timeMemory
1015233TroySerCombo (IOI18_combo)C++17
5 / 100
1 ms356 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;
    }
  }
  for (int i = 0; i < currPerm.size(); i++) {
    for (int j = 0; j < currPerm.size(); j++) {
      if (currPerm[i] == firsty || currPerm[j] == firsty) continue;
      string S;
      S += firsty;
      S += currPerm[i];
      S += currPerm[j];
      if (press(S) == 3) {
        return S;
      }
    }
  }
  return "ABCABCABC";
}

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:14:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |   for (int i = 0; i < currPerm.size(); i++) {
      |                   ~~^~~~~~~~~~~~~~~~~
combo.cpp:15:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int j = 0; j < currPerm.size(); j++) {
      |                     ~~^~~~~~~~~~~~~~~~~
combo.cpp:16:33: warning: 'firsty' may be used uninitialized in this function [-Wmaybe-uninitialized]
   16 |       if (currPerm[i] == firsty || currPerm[j] == firsty) continue;
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...