Submission #344938

#TimeUsernameProblemLanguageResultExecution timeMemory
344938lebasivillarCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <cstdio> #include <cstdlib> #include <algorithm> #include <string> #include "combo.h" int guess_one(const string& s) { int len = press(s + LET[0] + s + LET[1]); int idx = 2*(len < s.length()+1); len = press(s + LET[idx]); idx += (len < s.length()+1); return idx; } string guess_sequence(int N) { int idx[M]; REP(i, M) { idx[i] = i; } string s; { int id = guess_one(s); s += LET[id]; swap(idx[id], idx[M-1]); } REP(i, N-2) { string z; REP(j, M-1) { z += s + LET[idx[0]] + LET[idx[j]]; } z += s + LET[idx[1]]; int len = press(z); if (len == i+3) { s += LET[idx[0]]; } else if (len == i+2) { s += LET[idx[1]]; } else { s += LET[idx[2]]; } } if (N > 1) { int id = guess_one(s); s += LET[id]; } return s; }

Compilation message (stderr)

combo.cpp:7:21: error: 'string' does not name a type; did you mean 'stdin'?
    7 | int guess_one(const string& s) {
      |                     ^~~~~~
      |                     stdin
combo.cpp: In function 'int guess_one(const int&)':
combo.cpp:8:23: error: 'LET' was not declared in this scope
    8 |   int len = press(s + LET[0] + s + LET[1]);
      |                       ^~~
combo.cpp:9:24: error: request for member 'length' in 's', which is of non-class type 'const int'
    9 |   int idx = 2*(len < s.length()+1);
      |                        ^~~~~~
combo.cpp:11:19: error: request for member 'length' in 's', which is of non-class type 'const int'
   11 |   idx += (len < s.length()+1);
      |                   ^~~~~~
combo.cpp: At global scope:
combo.cpp:15:1: error: 'string' does not name a type; did you mean 'stdin'?
   15 | string guess_sequence(int N) {
      | ^~~~~~
      | stdin