Submission #349502

# Submission time Handle Problem Language Result Execution time Memory
349502 2021-01-17T16:57:04 Z David_M Combo (IOI18_combo) C++14
Compilation error
0 ms 0 KB
#include "combo.h"
#include <bits/stdc++.h>
#define p press
#define r return
std::string e,a="BXY";
std::string guess_sequence(int N){
p("XY")?ans='Y'-p("X"):ans='B'-p("A");
if(N==1)r ans;
if(ans!="A")a[(ans[0]-'B')%21]='A';
for(int i=1;i<N-1;i++)e+=a[p(e+a[1]+e+a[2]+a[0]+e+a[2]+a[1]+e+a[2]+a[2])-i];
if(p(ans+a[0])==N)r e+a[0];
if(p(ans+a[1])==N)r e+a[1];
r e+a[2];
}

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
    7 | p("XY")?ans='Y'-p("X"):ans='B'-p("A");
      |         ^~~
      |         abs