# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
437983 | illyakr | Horses (IOI15_horses) | C++14 | 1577 ms | 12040 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 <bits/stdc++.h>
#include "horses.h"
using namespace std;
#define ll long long
const ll mod = 1000000007;
const ll ge = 1000000000;
ll n;
ll x[501010], y[501010];
int init(int N, int X[], int Y[]) {
n = N;
for (ll i = 0; i < n; i++) {
x[i] = X[i];
y[i] = Y[i];
}
ll ans = 0, cnt = 1;
for (ll i = 0; i < n; i++) {
cnt *= x[i]; cnt %= ge;
ans = max(ans, y[i] * cnt);
ans %= mod;
}
return ans % mod;
}
int updateX(int pos, int val) {
x[pos] = val % mod;
ll ans = 0, cnt = 1;
for (ll i = 0; i < n; i++) {
cnt *= x[i]; cnt %= ge;
ans = max(ans, y[i] * cnt);
ans %= mod;
}
return ans % mod;
}
int updateY(int pos, int val) {
y[pos] = val % mod;
ll ans = 0, cnt = 1;
for (ll i = 0; i < n; i++) {
cnt *= x[i]; cnt %= ge;
ans = max(ans, y[i] * cnt);
ans %= mod;
}
return ans % 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... |