답안 #597274

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
597274 2022-07-15T20:29:20 Z Ozy 벽 칠하기 (APIO20_paint) C++17
컴파일 오류
0 ms 0 KB
#include "paint.h"
#include<bits/stdc++.h>
using namespace std;
#define lli int
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define debug(a) cout << #a << " = " << a << endl
#define debugsl(a) cout << #a << " = " << a << ", "

#define MAX 20000

lli a,ini;

int minimumInstructions(int N, int M, int K, std::vector<int> C,std::vector<int> A, std::vector<std::vector<int>> B) {
    n = N;
    m = M;
    k = K;

    a = -1;
    rep(i,0,m-1) {
        if (B[i][0] == C[0]) {
            a = i;
            break;
        }
    }
    if (a == -1) return -1;
    ini = a;

    lli res = 0;
    rep(i,0,n-1) {
        if (C[i] != B[a][0]) return -1;
        if (a == ini) res++;
        a++;
        a %= m;
    }

    return res;
}

Compilation message

paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:15:5: error: 'n' was not declared in this scope
   15 |     n = N;
      |     ^
paint.cpp:16:5: error: 'm' was not declared in this scope
   16 |     m = M;
      |     ^
paint.cpp:17:5: error: 'k' was not declared in this scope
   17 |     k = K;
      |     ^