This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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();
}
Compilation message (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... |