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 <vector>
#include <iostream>
using namespace std;
typedef long long ll;
vector<ll> x;
vector<ll> y;
vector<ll> num_h;
int n;
int M = 1e9+7;
ll multi(ll a,ll b){
return ((a%M)*(b%M))%M;
}
int calc(){
num_h = vector<ll>();
for(int i=0;i<n;i++)num_h.push_back(multi(x[i],((i==0)?1:num_h[i-1])));
// for(int i=0;i<n;i++)cout << num_h[i] << " ";
// cout << endl;
ll MX = 0;
for(int i=0;i<n;i++){
MX = max(MX,multi(num_h[i],y[i]));
}
int ans = MX%((int)1e9+7);
return ans;
}
int init(int N, int X[], int Y[]) {
n = N;
for(int i=0;i<N;i++)x.push_back(X[i]);
for(int i=0;i<N;i++)y.push_back(Y[i]);
return calc();
}
int updateX(int pos, int val) {
x[pos]=val;
return calc();
}
int updateY(int pos, int val) {
y[pos]=val;
return calc();
}
Compilation message (stderr)
horses.cpp: In function 'int calc()':
horses.cpp:29:14: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
29 | int ans = MX%((int)1e9+7);
| ~~^~~~~~~~~~~~~
# | 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... |