Submission #1122320

#TimeUsernameProblemLanguageResultExecution timeMemory
1122320khomeCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { vector<char> a; a={'X', 'Y', 'A', 'B'}; string res, cur; char per; int ab = press("AB"), bx = press("BX"), id=2; if (ab == 1) {        id = 2;        res = "AB"; }    if (ab == 1) {        if (bx == 1) { //BX = 1;            id=3; int by = press("BY"); if (by == 2) res = "BY"; else res = "BY"; }        if (bx == 2) {            id = 3; res += "BX"; }        if (bx == 0) { // BX = 0; AY, AX            id = 2; int ay = press("AY"); if (ay == 2) res = "AY"; else res = "AX"; } } else if (ab == 0) {        if (bx == 1) { // XA, XB, XY            id = 0; int xa = press("XA"), xb = press("XB"); if (xa == 2) res = "XA"; else if (xb == 2) res = "XB"; else res = "XY"; }        else { // YA, YB, YX            id = 1; int yb = press("YAAYABYAXYB"); if (yb == 3) res = "YA"; else if (yb == 2) res = "YB"; else res = "YX"; } } int n = res.size(); if (N==3){ int x = press(res+a[(id+1)%4]), y = press(res+a[(id+2)%4]); if (x == 3) return res+a[(id+1)%4]; else if (y == 3) return res+a[(id+2)%4]; else return res+a[(id+3)%4]; } char c = a[(id+1)%4], d = a[(id+2)%4], e = a[(id+3)%4]; int ask; while (n!=N-1){ n=res.size();        if (n==N-1) break; ask = press(res+c+c+res+c+d+res+c+e+res+d); if (ask == n+2) res += c; else if (ask == n+1) res += d; else res += e; } ask = press(res+c); if (ask == N) res+=c; else{ int ask2 = press(res+d); if (ask2 == N) res+=d; else res+=e;} return res; }

Compilation message (stderr)

combo.cpp:13:2: error: extended character   is not valid in an identifier
   13 |         id = 2;
      |  ^
combo.cpp:13:5: error: extended character   is not valid in an identifier
   13 |         id = 2;
      |    ^
combo.cpp:13:8: error: extended character   is not valid in an identifier
   13 |         id = 2;
      |      ^
combo.cpp:13:11: error: extended character   is not valid in an identifier
   13 |         id = 2;
      |        ^
combo.cpp:14:2: error: extended character   is not valid in an identifier
   14 |         res = "AB";
      |  ^
combo.cpp:14:5: error: extended character   is not valid in an identifier
   14 |         res = "AB";
      |    ^
combo.cpp:14:8: error: extended character   is not valid in an identifier
   14 |         res = "AB";
      |      ^
combo.cpp:14:11: error: extended character   is not valid in an identifier
   14 |         res = "AB";
      |        ^
combo.cpp:16:2: error: extended character   is not valid in an identifier
   16 |     if (ab == 1) {
      |  ^
combo.cpp:16:5: error: extended character   is not valid in an identifier
   16 |     if (ab == 1) {
      |    ^
combo.cpp:17:2: error: extended character   is not valid in an identifier
   17 |         if (bx == 1) { //BX = 1;
      |  ^
combo.cpp:17:5: error: extended character   is not valid in an identifier
   17 |         if (bx == 1) { //BX = 1;
      |    ^
combo.cpp:17:8: error: extended character   is not valid in an identifier
   17 |         if (bx == 1) { //BX = 1;
      |      ^
combo.cpp:17:11: error: extended character   is not valid in an identifier
   17 |         if (bx == 1) { //BX = 1;
      |        ^
combo.cpp:18:2: error: extended character   is not valid in an identifier
   18 |             id=3;
      |  ^
combo.cpp:18:5: error: extended character   is not valid in an identifier
   18 |             id=3;
      |    ^
combo.cpp:18:8: error: extended character   is not valid in an identifier
   18 |             id=3;
      |      ^
combo.cpp:18:11: error: extended character   is not valid in an identifier
   18 |             id=3;
      |        ^
combo.cpp:18:14: error: extended character   is not valid in an identifier
   18 |             id=3;
      |          ^
combo.cpp:18:17: error: extended character   is not valid in an identifier
   18 |             id=3;
      |            ^
combo.cpp:23:2: error: extended character   is not valid in an identifier
   23 |         if (bx == 2) {
      |  ^
combo.cpp:23:5: error: extended character   is not valid in an identifier
   23 |         if (bx == 2) {
      |    ^
combo.cpp:23:8: error: extended character   is not valid in an identifier
   23 |         if (bx == 2) {
      |      ^
combo.cpp:23:11: error: extended character   is not valid in an identifier
   23 |         if (bx == 2) {
      |        ^
combo.cpp:24:2: error: extended character   is not valid in an identifier
   24 |             id = 3;
      |  ^
combo.cpp:24:5: error: extended character   is not valid in an identifier
   24 |             id = 3;
      |    ^
combo.cpp:24:8: error: extended character   is not valid in an identifier
   24 |             id = 3;
      |      ^
combo.cpp:24:11: error: extended character   is not valid in an identifier
   24 |             id = 3;
      |        ^
combo.cpp:24:14: error: extended character   is not valid in an identifier
   24 |             id = 3;
      |          ^
combo.cpp:24:17: error: extended character   is not valid in an identifier
   24 |             id = 3;
      |            ^
combo.cpp:27:2: error: extended character   is not valid in an identifier
   27 |         if (bx == 0) { // BX = 0; AY, AX
      |  ^
combo.cpp:27:5: error: extended character   is not valid in an identifier
   27 |         if (bx == 0) { // BX = 0; AY, AX
      |    ^
combo.cpp:27:8: error: extended character   is not valid in an identifier
   27 |         if (bx == 0) { // BX = 0; AY, AX
      |      ^
combo.cpp:27:11: error: extended character   is not valid in an identifier
   27 |         if (bx == 0) { // BX = 0; AY, AX
      |        ^
combo.cpp:28:2: error: extended character   is not valid in an identifier
   28 |             id = 2;
      |  ^
combo.cpp:28:5: error: extended character   is not valid in an identifier
   28 |             id = 2;
      |    ^
combo.cpp:28:8: error: extended character   is not valid in an identifier
   28 |             id = 2;
      |      ^
combo.cpp:28:11: error: extended character   is not valid in an identifier
   28 |             id = 2;
      |        ^
combo.cpp:28:14: error: extended character   is not valid in an identifier
   28 |             id = 2;
      |          ^
combo.cpp:28:17: error: extended character   is not valid in an identifier
   28 |             id = 2;
      |            ^
combo.cpp:35:2: error: extended character   is not valid in an identifier
   35 |         if (bx == 1) { // XA, XB, XY
      |  ^
combo.cpp:35:5: error: extended character   is not valid in an identifier
   35 |         if (bx == 1) { // XA, XB, XY
      |    ^
combo.cpp:35:8: error: extended character   is not valid in an identifier
   35 |         if (bx == 1) { // XA, XB, XY
      |      ^
combo.cpp:35:11: error: extended character   is not valid in an identifier
   35 |         if (bx == 1) { // XA, XB, XY
      |        ^
combo.cpp:36:2: error: extended character   is not valid in an identifier
   36 |             id = 0;
      |  ^
combo.cpp:36:5: error: extended character   is not valid in an identifier
   36 |             id = 0;
      |    ^
combo.cpp:36:8: error: extended character   is not valid in an identifier
   36 |             id = 0;
      |      ^
combo.cpp:36:11: error: extended character   is not valid in an identifier
   36 |             id = 0;
      |        ^
combo.cpp:36:14: error: extended character   is not valid in an identifier
   36 |             id = 0;
      |          ^
combo.cpp:36:17: error: extended character   is not valid in an identifier
   36 |             id = 0;
      |            ^
combo.cpp:42:2: error: extended character   is not valid in an identifier
   42 |         else { // YA, YB, YX
      |  ^
combo.cpp:42:5: error: extended character   is not valid in an identifier
   42 |         else { // YA, YB, YX
      |    ^
combo.cpp:42:8: error: extended character   is not valid in an identifier
   42 |         else { // YA, YB, YX
      |      ^
combo.cpp:42:11: error: extended character   is not valid in an identifier
   42 |         else { // YA, YB, YX
      |        ^
combo.cpp:43:2: error: extended character   is not valid in an identifier
   43 |             id = 1;
      |  ^
combo.cpp:43:5: error: extended character   is not valid in an identifier
   43 |             id = 1;
      |    ^
combo.cpp:43:8: error: extended character   is not valid in an identifier
   43 |             id = 1;
      |      ^
combo.cpp:43:11: error: extended character   is not valid in an identifier
   43 |             id = 1;
      |        ^
combo.cpp:43:14: error: extended character   is not valid in an identifier
   43 |             id = 1;
      |          ^
combo.cpp:43:17: error: extended character   is not valid in an identifier
   43 |             id = 1;
      |            ^
combo.cpp:63:2: error: extended character   is not valid in an identifier
   63 |         if (n==N-1) break;
      |  ^
combo.cpp:63:5: error: extended character   is not valid in an identifier
   63 |         if (n==N-1) break;
      |    ^
combo.cpp:63:8: error: extended character   is not valid in an identifier
   63 |         if (n==N-1) break;
      |      ^
combo.cpp:63:11: error: extended character   is not valid in an identifier
   63 |         if (n==N-1) break;
      |        ^
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:2: error: '\U000000a0' was not declared in this scope
   13 |         id = 2;
      |  ^
combo.cpp:14:4: error: expected ';' before '\U000000a0'
   14 |         res = "AB";
      |   ^~
      |   ;
combo.cpp:16:2: error: '\U000000a0' was not declared in this scope
   16 |     if (ab == 1) {
      |  ^
combo.cpp:34:5: error: 'else' without a previous 'if'
   34 |     else if (ab == 0) {
      |     ^~~~
combo.cpp:35:4: error: expected ';' before '\U000000a0'
   35 |         if (bx == 1) { // XA, XB, XY
      |   ^~
      |   ;
combo.cpp:42:4: error: expected ';' before '\U000000a0'
   42 |         else { // YA, YB, YX
      |   ^~
      |   ;
combo.cpp:63:4: error: expected ';' before '\U000000a0'
   63 |         if (n==N-1) break;
      |   ^~
      |   ;
combo.cpp:10:10: warning: unused variable 'per' [-Wunused-variable]
   10 |     char per;
      |          ^~~
combo.cpp:11:27: warning: unused variable 'bx' [-Wunused-variable]
   11 |     int ab = press("AB"), bx = press("BX"), id=2;
      |                           ^~