Submission #501526

#TimeUsernameProblemLanguageResultExecution timeMemory
501526dnauxCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N){ string s = ""; char c1 = 'X',c2 = 'Y',c3 = 'A'; if(press("XY") != 0){ if(press("X") != 0){s += 'X';c1 = 'B';} else {s += 'Y';c2 = 'B';} } else{ if(press('A') != 0)(s += 'A';c3 = 'B';) else s += 'B'; } for(int i = 0;i < n - 1; i++){ if(press(s + c1 + s + c2) > i + 1){ if(press(s + c1) > i + 1){ s += c1; } else{ s += c2; } } else s += c3; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:18: error: could not convert ''A'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   13 |         if(press('A') != 0)(s += 'A';c3 = 'B';)
      |                  ^~~
      |                  |
      |                  char
combo.cpp:13:37: error: expected ')' before ';' token
   13 |         if(press('A') != 0)(s += 'A';c3 = 'B';)
      |                            ~        ^
      |                                     )
combo.cpp:13:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   13 |         if(press('A') != 0)(s += 'A';c3 = 'B';)
      |         ^~
combo.cpp:13:38: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   13 |         if(press('A') != 0)(s += 'A';c3 = 'B';)
      |                                      ^~
combo.cpp:13:47: error: expected primary-expression before ')' token
   13 |         if(press('A') != 0)(s += 'A';c3 = 'B';)
      |                                               ^
combo.cpp:16:23: error: 'n' was not declared in this scope
   16 |     for(int i = 0;i < n - 1; i++){
      |                       ^