이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "horses.h"
#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
const int MAX_N = 5e5 + 5;
const int mod = 1e9 + 7;
int n;
ll x[MAX_N], y[MAX_N];
int Solve() {
ll ans = 0;
ll cnt = 1;
for (int i = 0; i < n; i++) {
cnt *= x[i];
chkmax(ans, y[i] * cnt);
}
return ans % mod;
}
int init(int N, int X[], int Y[]) {
n = N;
for (int i = 0; i < n; i++) {
x[i] = X[i], y[i] = Y[i];
}
return Solve();
}
int updateX(int pos, int val) {
x[pos] = val;
return Solve();
}
int updateY(int pos, int val) {
y[pos] = val;
return Solve();
}
컴파일 시 표준 에러 (stderr) 메시지
horses.cpp: In function 'int Solve()':
horses.cpp:28:16: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
28 | return ans % mod;
| ~~~~^~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |