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>
using namespace std;
typedef unsigned long long ll;
typedef vector<ll> vl;
typedef long double ld;
//#include "grader.cpp"
vl x,y;
void chkmax(ll& ans,ll has,ll p){
ll mod=1e9+7;
if(log10(ld(ans))<log10(ld(has))+log10(ld(p)))
ans=((has%mod)*(p%mod))%mod;
}
int init(int n, int X[], int Y[]) {
x.resize(n);
y.resize(n);
const ll mod=1e9+7;
ll has=1,ans=0;
for(int i=0; i<n; i++)
x[i]=ll(1ll*X[i]),y[i]=ll(1ll*Y[i]);
for(int i=0; i<n; i++){
has*=x[i];
chkmax(ans,has,y[i]);
}
return int(ans);
}
int updateX(int pos, int val) {
const ll mod=1e9+7;
ll has=1,ans=0;
x[pos]=ll(val);
int n=x.size();
for(int i=0; i<n; i++){
has*=x[i];
chkmax(ans,has,y[i]);
}
return int(ans);
}
int updateY(int pos, int val) {
const ll mod=1e9+7;
ll has=1,ans=0;
y[pos]=ll(val);
int n=x.size();
for(int i=0; i<n; i++){
has*=x[i];
chkmax(ans,has,y[i]);
}
return int(ans);
}
Compilation message (stderr)
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:21:14: warning: unused variable 'mod' [-Wunused-variable]
21 | const ll mod=1e9+7;
| ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:37:17: warning: conversion from 'std::vector<long long unsigned int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
37 | int n=x.size();
| ~~~~~~^~
horses.cpp:34:14: warning: unused variable 'mod' [-Wunused-variable]
34 | const ll mod=1e9+7;
| ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:49:17: warning: conversion from 'std::vector<long long unsigned int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
49 | int n=x.size();
| ~~~~~~^~
horses.cpp:46:14: warning: unused variable 'mod' [-Wunused-variable]
46 | const ll mod=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... |