Submission #110012

#TimeUsernameProblemLanguageResultExecution timeMemory
110012mefbayarCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string s; char c[4]; string guess_sequence(int N){ int k; if(press("AB")){ if(press("A")){ c[0]="B"; c[1]="X"; c[2]="Y"; s="A"; }else{ c[0]="A"; c[1]="X"; c[2]="Y"; s="B"; } }else{ if(press("X")){ c[0]="B"; c[1]="A"; c[2]="Y"; s="X"; }else{ c[0]="A"; c[1]="X"; c[2]="B"; s="Y"; } } if(N==1) return s; for(int i = 2; i < N; i++){ k = press(s + c[0] + c[1] + s + c[0] + c[0] + s + c[0] + c[2] + s + c[1]); if(k == i + 1){ s += c[0]; } else if(k == i){ s += c[1]; } else { s += c[2]; } } if(press(s + c[0]) == N){ s += c[0]; } else { if(press(s + c[1]) == N){ s += c[1]; } else { s += c[2]; } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:9: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   10 |    c[0]="B";
      |         ^~~
      |         |
      |         const char*
combo.cpp:11:9: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   11 |    c[1]="X";
      |         ^~~
      |         |
      |         const char*
combo.cpp:12:9: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   12 |    c[2]="Y";
      |         ^~~
      |         |
      |         const char*
combo.cpp:15:9: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   15 |    c[0]="A";
      |         ^~~
      |         |
      |         const char*
combo.cpp:16:9: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   16 |    c[1]="X";
      |         ^~~
      |         |
      |         const char*
combo.cpp:17:9: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   17 |    c[2]="Y";
      |         ^~~
      |         |
      |         const char*
combo.cpp:22:9: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   22 |    c[0]="B";
      |         ^~~
      |         |
      |         const char*
combo.cpp:23:9: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   23 |    c[1]="A";
      |         ^~~
      |         |
      |         const char*
combo.cpp:24:9: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   24 |    c[2]="Y";
      |         ^~~
      |         |
      |         const char*
combo.cpp:27:9: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   27 |    c[0]="A";
      |         ^~~
      |         |
      |         const char*
combo.cpp:28:9: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   28 |    c[1]="X";
      |         ^~~
      |         |
      |         const char*
combo.cpp:29:9: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   29 |    c[2]="B";
      |         ^~~
      |         |
      |         const char*