제출 #1191930

#제출 시각아이디문제언어결과실행 시간메모리
1191930p4r4d0_xCombo (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long

string guess_sequence(int N) {
  vector<char> a = {'A', 'B', 'X', 'Y'};
  string s;
  if(press("AB")){
      if(press("A")) s = "A";  
    else s = "B";
  }
  else if(press("X"))s="X";
  else s = "Y";
  if(n!=3)return "a";
  ll cnt = 1;
  vector<char> v;
  for(int i = 0; i < 4; ++i){
      if(a[i] != s[0]){
          v.pb(a[i]);
      }
  }
  string b = "", x = "", y = "";
  b += v[0];
  x += v[1];
  y += v[2];
  
  while(1){
      cnt++;
      if(cnt==N){
  if(press(s + b) == N){
    s += b;  
  }
  else if(press(s + x) == N){
    s += x;  
  }
  else s += y;
          break;
      }
      else{
      ll count = press(s + b + s + x + b + s + x + y + s + x + x);
      if(count == cnt ){
          s += b;
      }
      else if(count == cnt + 1){
          s += x;
      }
      else s += y;
      }
  }
  return s;
}

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:6: error: 'n' was not declared in this scope
   16 |   if(n!=3)return "a";
      |      ^