Submission #1194588

#TimeUsernameProblemLanguageResultExecution timeMemory
1194588ahmetlbktd4Combo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n){ string s = ""; int p[3] = {0,1,2}; lab:if (p[0] > 3){ return ""; } for (int i = 2;i > 0;i--){ if (p[i] > 3){ p[i] = 1;p[i-1]++;goto lab; } } for (int i = 1;i < 3;i++){ if (p[i] == p[0]) goto la; } for (int i = 0;i < 3;i++){ if (p[i] == 0) s+="A"; if (p[i] == 1) s+="B"; if (p[i] == 2) s+="X"; if (p[i] == 3) s+="Y"; } int q = press(s); if (q == n){ return s; } la:p[2]++;goto lab; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:9: error: jump to label 'la'
   34 |         la:p[2]++;goto lab;
      |         ^~
combo.cpp:18:22: note:   from here
   18 |                 goto la;
      |                      ^~
combo.cpp:30:13: note:   crosses initialization of 'int q'
   30 |         int q = press(s);
      |             ^