Submission #1006853

#TimeUsernameProblemLanguageResultExecution timeMemory
1006853GTACombo (IOI18_combo)C++17
0 / 100
2 ms600 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
#define fr(m,n,k) for(int m=n;m<=k;m++)

int n;
string guess_sequence(int N) {
  n = N;
  string v = "ABXY";
  string p;

  int a;
  fr(j, 0, 3) {
    p = v[j];
    int x = press(p);
    if (x == 1) {
      a = j;
      break;
    }
  }
  p = v[a];

  fr(i, 2, n) {
    fr(j, 0, 3) {
      if (j == a) continue;
      p += v[j];
      int x = press(p);
      if (x == i) {
        break;
      }
      else p.erase(--p.end());
      if (j == 2) {
        p += v[3];
        break;
      }
    }
  }
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
   38 | }
      | ^
combo.cpp:21:10: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
   21 |   p = v[a];
      |          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...