제출 #421027

#제출 시각아이디문제언어결과실행 시간메모리
421027LouayFarah말 (IOI15_horses)C++14
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" #include "horses.h" using namespace std; int n; vector<int> x, y; int solve(int h, int i, int curr) { if(i==n) { return curr; } int t = h*x[i]; int maxi = curr; for(int j = 0; j<=t; j++) { maxi = max(maxi, solve(t-j, i+1, (curr%MOD + ((j%MOD)*(y[i])%MOD)%MOD))%MOD); } return maxi; } int init(int N, int X[], int Y[]) { n = N; x.assign(n, 0); y.assign(n, 0); for(int i = 0; i<n; i++) { x[i] = X[i]; y[i] = Y[i]; } int res = solve(1, 0, 0); return res; } int updateX(int pos, int val) { x[pos] = val; int res = solve(1, 0, 0); return res; } int updateY(int pos, int val) { y[pos] = val; int res = solve(1, 0, 0); return res; }

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

horses.cpp: In function 'int solve(int, int, int)':
horses.cpp:20:48: error: 'MOD' was not declared in this scope
   20 |         maxi = max(maxi, solve(t-j, i+1, (curr%MOD + ((j%MOD)*(y[i])%MOD)%MOD))%MOD);
      |                                                ^~~