제출 #631935

#제출 시각아이디문제언어결과실행 시간메모리
631935Stavab말 (IOI15_horses)C++14
컴파일 에러
0 ms0 KiB
#include <vector> using namespace std; vector<long long> mult, y, x; long long ans() { long long maxVal = 0; for(int i = 0; i < mult.size(); i++) { maxVal = max(maxVal, mult[i]*y[i] % 1000000007); } return maxVal; } long long init(int N, vector<long long> X, vector<long long> Y) { mult.assign(N, 0); mult[0] = X[0]; x.assign(N, 0); x[0] = X[0]; y.assign(N, 0); y[0] = Y[0]; for(int i = 1; i < N; i++) { mult[i] = (mult[i - 1] * X[i]) % 1000000007; y[i] = Y[i]; x[i] = X[i]; } return ans(); } int updateX(int pos, int val) { x[pos] = val; for(int i = pos; i < N; i++) mult[i] = mult[i - 1] * x[i]; return ans(); } int updateY(int pos, int val) { y[pos] = val; return ans(); }

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

horses.cpp: In function 'long long int ans()':
horses.cpp:10:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i = 0; i < mult.size(); i++)
      |                    ~~^~~~~~~~~~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:40:26: error: 'N' was not declared in this scope
   40 |     for(int i = pos; i < N; i++)
      |                          ^
horses.cpp:42:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   42 |     return ans();
      |            ~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:48:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   48 |     return ans();
      |            ~~~^~