Submission #1301795

#TimeUsernameProblemLanguageResultExecution timeMemory
1301795hectormedranoCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <cstdio> #include <cstdlib> #include <algorithm> #include <string> #include "combo.h" using namespace std; string guess_sequence(int N) { string S, p; ll cont = N-3; S = ""; if(N == 3){ if(press("A")){return "A";} if(press("B")){return "B";} if(press("X")){return "X";} if(press("Y")){return "Y";} } char F; ll k1 = press("ABX"); if(k1 == 0){ F = 'Y'; S += 'Y'; cont++; } if(k1 == 3){ F = 'A'; S += 'Y'; cont++; } if(k1 == 2){ ll k2 = press("AB"); if(k2 == 1){ F = 'B'; S += "BX"; } if(k2 == 2){ F = 'A'; S += "AB"; } } if(k1 == 1){ ll k2 = press("AXB"); if(k2 == 3){ F = 'A'; S += "AX"; } if(k2 == 1){ ll k3 = press("XA"); if(k3 == 0){ F = 'B'; S += "BA"; } if(k3 == 2){ F = 'X'; S += "XA"; } } if(k2 == 2){ ll k3 = press("AX"); if(k3 == 1){ F = 'X'; S += "XB"; } if(k2 == 2){ F = 'A'; S += "AX"; } } string c = ""; if(F != 'A'){ c += A; } if(F != 'B'){ c += B; } if(F != 'X'){ c += X; } if(F != 'Y'){ c += Y; } while(cont--){ p = S + c[0] + S + c[1] + c[0] + S + c[1] + c[1] + S + c[1] + c[2]; ll k = press(p); if(k == S.size()){ S += c[2]; } if(k == S.size() + 1){ S += c[0]; } if(k == S.size() + 2){ S += c[1]; } } p = S + c[0] + S + c[1] ll k = press(p); if(k == N){ if(press(S + c[0]) == N){S += c[0];} else{S += c[1];} } else { S += c[2]; } } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:3: error: 'll' was not declared in this scope
   11 |   ll cont = N-3;
      |   ^~
combo.cpp:20:5: error: expected ';' before 'k1'
   20 |   ll k1 = press("ABX");
      |     ^~~
      |     ;
combo.cpp:21:6: error: 'k1' was not declared in this scope; did you mean 'y1'?
   21 |   if(k1 == 0){
      |      ^~
      |      y1
combo.cpp:24:5: error: 'cont' was not declared in this scope; did you mean 'const'?
   24 |     cont++;
      |     ^~~~
      |     const
combo.cpp:26:6: error: 'k1' was not declared in this scope; did you mean 'y1'?
   26 |   if(k1 == 3){
      |      ^~
      |      y1
combo.cpp:29:5: error: 'cont' was not declared in this scope; did you mean 'const'?
   29 |     cont++;
      |     ^~~~
      |     const
combo.cpp:31:6: error: 'k1' was not declared in this scope; did you mean 'y1'?
   31 |   if(k1 == 2){
      |      ^~
      |      y1
combo.cpp:32:7: error: expected ';' before 'k2'
   32 |     ll k2 = press("AB");
      |       ^~~
      |       ;
combo.cpp:33:8: error: 'k2' was not declared in this scope
   33 |     if(k2 == 1){
      |        ^~
combo.cpp:37:8: error: 'k2' was not declared in this scope
   37 |     if(k2 == 2){
      |        ^~
combo.cpp:42:6: error: 'k1' was not declared in this scope; did you mean 'y1'?
   42 |   if(k1 == 1){
      |      ^~
      |      y1
combo.cpp:43:7: error: expected ';' before 'k2'
   43 |     ll k2 = press("AXB");
      |       ^~~
      |       ;
combo.cpp:44:8: error: 'k2' was not declared in this scope
   44 |     if(k2 == 3){
      |        ^~
combo.cpp:48:8: error: 'k2' was not declared in this scope
   48 |     if(k2 == 1){
      |        ^~
combo.cpp:49:11: error: expected ';' before 'k3'
   49 |         ll k3 = press("XA");
      |           ^~~
      |           ;
combo.cpp:50:12: error: 'k3' was not declared in this scope
   50 |         if(k3 == 0){
      |            ^~
combo.cpp:54:12: error: 'k3' was not declared in this scope
   54 |         if(k3 == 2){
      |            ^~
combo.cpp:59:8: error: 'k2' was not declared in this scope
   59 |     if(k2 == 2){
      |        ^~
combo.cpp:60:11: error: expected ';' before 'k3'
   60 |         ll k3 = press("AX");
      |           ^~~
      |           ;
combo.cpp:61:12: error: 'k3' was not declared in this scope
   61 |         if(k3 == 1){
      |            ^~
combo.cpp:72:14: error: 'A' was not declared in this scope
   72 |         c += A;
      |              ^
combo.cpp:75:14: error: 'B' was not declared in this scope
   75 |         c += B;
      |              ^
combo.cpp:78:14: error: 'X' was not declared in this scope
   78 |         c += X;
      |              ^
combo.cpp:81:14: error: 'Y' was not declared in this scope
   81 |         c += Y;
      |              ^
combo.cpp:83:11: error: 'cont' was not declared in this scope; did you mean 'const'?
   83 |     while(cont--){
      |           ^~~~
      |           const
combo.cpp:85:11: error: expected ';' before 'k'
   85 |         ll k = press(p);
      |           ^~
      |           ;
combo.cpp:86:12: error: 'k' was not declared in this scope
   86 |         if(k == S.size()){
      |            ^
combo.cpp:89:12: error: 'k' was not declared in this scope
   89 |         if(k == S.size() + 1){
      |            ^
combo.cpp:92:12: error: 'k' was not declared in this scope
   92 |         if(k == S.size() + 2){
      |            ^
combo.cpp:96:28: error: expected ';' before 'll'
   96 |     p = S + c[0] + S + c[1]
      |                            ^
      |                            ;
   97 |     ll k = press(p);
      |     ~~                      
combo.cpp:98:8: error: 'k' was not declared in this scope
   98 |     if(k == N){
      |        ^