Submission #839653

#TimeUsernameProblemLanguageResultExecution timeMemory
839653sleepntsheepCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" #include <cassert> #include <string> #include <vector> using namespace std; string guess_sequence(int N) { string S, opt; int fst = -1, C = 0; int non[2005][4] = {0}; for (int i = 0; i < 4 && !j; ++i) { for (int j = 0; opt.empty() && j < 4; ++j) { if (press("A")) opt="BXY", S="A"; else if (press("B")) opt="AXY", S="B"; else if (press("X")) opt="ABY", S="X"; else if (press("Y")) opt="ABX", S="Y"; } } for (int i = 1; i < N - 1; ++i) { string ask = S + opt[0] + opt[0] + S + opt[0] + opt[1] + S + opt[0] + opt[2] + S + opt[1]; int k = press(ask); if (k == i + 2) S += opt[0]; else if (k == i + 1) S += opt[1]; else S += opt[2]; } if (press(S+opt[0])==N) S+=opt[0]; if (press(S+opt[1])==N) S+=opt[1]; if (press(S+opt[2])==N) S+=opt[2]; return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:31: error: 'j' was not declared in this scope
   13 |     for (int i = 0; i < 4 && !j; ++i)
      |                               ^
combo.cpp:10:9: warning: unused variable 'fst' [-Wunused-variable]
   10 |     int fst = -1, C = 0;
      |         ^~~
combo.cpp:10:19: warning: unused variable 'C' [-Wunused-variable]
   10 |     int fst = -1, C = 0;
      |                   ^
combo.cpp:11:9: warning: unused variable 'non' [-Wunused-variable]
   11 |     int non[2005][4] = {0};
      |         ^~~