# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1085332 | guagua0407 | Horses (IOI15_horses) | C++17 | 1594 ms | 16124 KiB |
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;
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
vector<ll> x,y;
const ll inf=1e9;
const ll mod=1e9+7;
int init(int N, int X[], int Y[]) {
n=N;
x.resize(n);
y.resize(n);
for(int i=0;i<n;i++){
x[i]=X[i];
y[i]=Y[i];
}
int best=n-1;
ll cur=y[n-1];
for(int i=n-1;i>=0;i--){
if(y[i]>cur){
best=i;
cur=y[i];
}
if(cur*x[i]>inf) break;
cur*=x[i];
}
ll ans=1;
for(int i=0;i<=best;i++){
ans=ans*x[i]%mod;
}
ans=ans*y[best]%mod;
return ans;
}
int updateX(int pos, int val) {
x[pos]=val;
int best=n-1;
ll cur=y[n-1];
for(int i=n-1;i>=0;i--){
if(y[i]>cur){
best=i;
cur=y[i];
}
if(cur*x[i]>inf) break;
cur*=x[i];
}
ll ans=1;
for(int i=0;i<=best;i++){
ans=ans*x[i]%mod;
}
ans=ans*y[best]%mod;
return ans;
}
int updateY(int pos, int val) {
y[pos]=val;
int best=n-1;
ll cur=y[n-1];
for(int i=n-1;i>=0;i--){
if(y[i]>cur){
best=i;
cur=y[i];
}
if(cur*x[i]>inf) break;
cur*=x[i];
}
ll ans=1;
for(int i=0;i<=best;i++){
ans=ans*x[i]%mod;
}
ans=ans*y[best]%mod;
return ans;
}
Compilation message (stderr)
# | 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... |