제출 #334697

#제출 시각아이디문제언어결과실행 시간메모리
334697blueHorses (IOI15_horses)C++17
컴파일 에러
0 ms0 KiB
#include "horses.h"
#include <algorithm>
using namespace std;

int N;
int* X;
int* Y;

int answer()
{
    long long product_X[N];
    product_X[0] = X[0];
    for(int i = 1; i < N; i++) product_X[i] = (product_X[i-1] * X[i]) % mod;

    int y = 0;
    int res = 0;
    for(int i = N-1; i >= 0; i--)
    {
        y = max(y, Y[i]);
        res = max(res, int((product_X[i] * y) % mod));
    }
    return res;
}

int init(int n, int x[], int y[])
{
    N = n;
    X = x;
    Y = y;

    return answer();
}

int updateX(int pos, int val)
{
    X[pos] = val;
    return answer();
}

int updateY(int pos, int val)
{
    Y[pos] = val;
    return answer();
}

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

horses.cpp: In function 'int answer()':
horses.cpp:13:73: error: 'mod' was not declared in this scope
   13 |     for(int i = 1; i < N; i++) product_X[i] = (product_X[i-1] * X[i]) % mod;
      |                                                                         ^~~
horses.cpp:20:49: error: 'mod' was not declared in this scope
   20 |         res = max(res, int((product_X[i] * y) % mod));
      |                                                 ^~~