제출 #1007248

#제출 시각아이디문제언어결과실행 시간메모리
1007248christinelynn콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#include "combo.h"
/* Pragmaaa */
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

/*  Primitive Data   */
#define ll long long
#define db double

/*  Pair Macro */
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define sc second

/* Vector Macro */
#define vi vector<int>
#define vll vector<ll>
#define pb push_back

/*  All Rounder  */
#define all(x) x.begin(),x.end()
#define forn(i,n) for(int (i) = 1; i<= int (n); i++)
#define for0(i,n) for(int (i) = 0; i < int (n); i++)

#define INF 1e9 
#define LLINF 1e18
#define nl '\n'
#define tab '	'


using namespace std;

string guess_sequence(int N){
  char a[9];
  bool vis[9] = {0};
  a[1] = 'A', a[2] = 'B', a[3] = 'X',a[4] = 'Y';
  
  
  if(press("A"))vis[1] = 1;
  else if(press("B"))vis[2] = 1;
  else if(press("X"))vis[3] = 1;
  else vis[4] = 1;
  string p = "";
  if(vis[1])p += "A";
  if(vis[2])p += "B";
  if(vis[3])p += "X";
  if(vis[4])p += "Y";
  
  for(int i = 2; i<=n; i++){
    
    for(int j = 1; j<=4; j++){
      if(vis[j])continue;
      if(j == 4){
        p += "Y";
        break;
      }
      if(j == 1 && press(string(p + "A")) == i){
        p+="A";
        break;
      }else if(j == 2 && press(string(p + "B")) == i){
        p +="B";
        break;
      }else if(j == 3 && press(string(p+"X")) == i){
        p+="X";
        break;
      }
      
    }
    
    
  }
  
  
  return p;
}
       

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

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