Submission #1311308

#TimeUsernameProblemLanguageResultExecution timeMemory
1311308tschav_콤보 (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "combo.h" using namespace std; string guess_sequence(int N) { string s1 = "ABACAXB"; string s2(N, 'C'); char init; int a1 = press(s1); if(a1 == 2) init = 'A'; if(a1 == 1) init = 'B'; int a2 = press(s2); if(a2) init = 'C'; else init = 'Y'; string S(N, init); string last = ""; last += init; set<char> st; st.insert('A'); st.insert('B'); st.insert('X'); st.insert('Y'); st.erase(init); char c[3]; int ptr = 0; for(auto &ch : st) { c[ptr++] = ch; } for(int i = 1; i+1 < N; i++) { string Q; Q += last; Q += c[0]; Q += last; Q += c[1]; Q += c[0]; Q += last; Q += c[1]; Q += c[1]; Q += last; Q += c[1]; Q += c[2]; int res = press(Q); if(res == last.size()+1){ S[i] = c[0]; last += c[0]; }else if(res == last.size()+2){ S[i] = c[1]; last += c[1]; }else{ S[i] = c[2]; last += c[2]; } } string Q = last + c[0]; int res = press(Q); if(res == last.size()+1){ S[N-1] = c[0]; }else{ Q = last + c[1]; res = press(Q); if(res == last.size()+1){ S[N-1] = c[1]; }else{ S[N-1] = c[2]; } } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:5: error: 'set' was not declared in this scope
   18 |     set<char> st;
      |     ^~~
combo.cpp:2:1: note: 'std::set' is defined in header '<set>'; did you forget to '#include <set>'?
    1 | #include "combo.h"
  +++ |+#include <set>
    2 | using namespace std;
combo.cpp:18:9: error: expected primary-expression before 'char'
   18 |     set<char> st;
      |         ^~~~
combo.cpp:19:5: error: 'st' was not declared in this scope; did you mean 's2'?
   19 |     st.insert('A');
      |     ^~
      |     s2