# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
234191 | jhtan | Horses (IOI15_horses) | C++14 | 1585 ms | 16232 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 <algorithm>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
ll V[500000];
ll XX[500000];
ll YY[500000];
int n;
int init(int N, int X[], int Y[]) {
// For 17 points
/*
int V[N];
V[0] = X[0];
for(int i=1; i<N; i++) V[i] = V[i-1] * X[i];
int mx = 0;
for(int i=0; i<N; i++) mx = max(mx, V[i] * Y[i]);
*/
n = N;
for(int i=0; i<N; i++) {
YY[i] = Y[i];
XX[i] = X[i];
}
V[0] = X[0];
for(int i=1; i<N; i++) V[i] = (V[i-1] * X[i]) % MOD;
ll mx = 0;
for(int i=0; i<N; i++) mx = max(mx, (V[i] * Y[i]));
return mx % MOD;
}
int updateX(int pos, int val) {
XX[pos] = val;
for(int i=pos; i<n; i++) V[i] = (V[i-1] * XX[i]) % MOD;
ll mx = 0;
for(int i=0; i<n; i++) mx = max(mx, (V[i] * YY[i]));
return mx % MOD;
}
int updateY(int pos, int val) {
YY[pos] = val;
ll mx = 0;
for(int i=0; i<n; i++) mx = max(mx, (V[i] * YY[i]));
return mx % MOD;
}
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... |