#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> gh, fg; long long u, l=1, mod=1e9+7;
int init(int n, int x[], int y[]) {
gh.resize(n); fg.resize(n); for(long long i=0; i<n; i++) gh[i]=x[i]; for(long long i=0; i<n; i++) fg[i]=y[i];
long long k=0; u=n;
for(long long i=0; i<n; i++){l*=gh[i]%mod; if(k>l*fg[i]){k=l*fg[i]%mod;}}
return k%mod;
}
int updateX(int pos, int val) {
gh[pos]=val; long long hjg=0, kj=1;
for(long long i=0; i<u; i++){kj*=gh[i]%mod; if(hjg>kj*fg[i]){hjg=kj*fg[i]%mod;} }
return hjg%mod;
}
int updateY(int pos, int val) {
fg[pos]=val; long long jh=0, ghj=1;
for(long long i=0; i<u; i++){ghj*=gh[i]%mod; if(jh>ghj*fg[i]){jh=ghj*fg[i]%mod;}}
return jh%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... |