# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
830377 | mindiyak | Horses (IOI15_horses) | C++14 | 1588 ms | 14284 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 <vector>
#include <iostream>
using namespace std;
typedef long long ll;
vector<ll> x;
vector<ll> y;
int n;
int M = 1e9+7;
ll multi(ll a,ll b){
return ((a%M)*(b%M))%M;
}
int calc(){
int MX_pos = 0;
ll cur = 1;
for(int i=1;i<n;i++){
ll multiply = cur*x[i];
if(multiply*y[i]>=y[MX_pos]){
MX_pos = i;
cur=1;
}else{
cur=multiply;
}
}
ll MX = 1;
for(int i=0;i<MX_pos+1;i++){
MX = multi(MX,x[i]);
}
int ans = multi(MX,y[MX_pos]);
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)
# | 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... |