Submission #707546

#TimeUsernameProblemLanguageResultExecution timeMemory
707546firewaterCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include "combo.h"
#define ll long long
using namespace std;
string str,p;
char a[10];
int x,w;

std::string guess_sequence(int N) {
  if(press("A"))str="A";
  else if(press("B"))str="B";
  else if(press("X"))str="X";
  else str="Y";
  if(str[0]!='A')a[++w]='A';
  if(str[0]!='B')a[++w]='B';
  if(str[0]!='X')a[++w]='X';
  if(str[0]!='Y')a[++w]='Y';
  for(int i=2;i<=n;++i){
  	p=str+a[1]+a[1]+str+a[1]+a[2]+str+a[1]+a[3]+str+a[2];
  	x=press(p);
  	if(x==2)str+=a[1];
  	else if(x==1)str+=a[2];
  	else str+=a[3];
  }
  return str;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:18: error: 'n' was not declared in this scope
   21 |   for(int i=2;i<=n;++i){
      |                  ^