Submission #95569

#TimeUsernameProblemLanguageResultExecution timeMemory
95569shenxyCombo (IOI18_combo)C++11
Compilation error
0 ms0 KiB
#include "combo.h" #include <string> #include <algorithm> using namespace std; string guess_sequence(int N) { string p = ""; for (int i = 1; i <= N; ++i) { p += "A"; int K = press(p); if (K < i) { p.pop_back(); p += "B"; } else continue; int K = press(p); if (K < i) { p.pop_back(); p += "X"; } else continue; int K = press(p); if (K < i) { p.pop_back(); p += "Y"; } else continue; } return p; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:14:13: error: redeclaration of 'int K'
   14 |         int K = press(p);
      |             ^
combo.cpp:9:13: note: 'int K' previously declared here
    9 |         int K = press(p);
      |             ^
combo.cpp:19:13: error: redeclaration of 'int K'
   19 |         int K = press(p);
      |             ^
combo.cpp:9:13: note: 'int K' previously declared here
    9 |         int K = press(p);
      |             ^