# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1088276 | dosts | Horses (IOI15_horses) | C++17 | 1541 ms | 14172 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 int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define sp << " " <<
#define all(cont) cont.begin(),cont.end()
#define vi vector<int>
const int MOD = 1e9+7,inf = 2e14;
const int N = 5e5+50;
int add(int x,int y) {
return ((x+y) >= MOD ? x+y-MOD : x+y);
}
int mult(int x,int y) {
return ((x%MOD)*(y%MOD))%MOD;
}
int x[N],y[N];
int32_t init(int32_t N, int32_t X[], int32_t Y[]) {
for (int i=0;i<N;i++) x[i] = X[i],y[i] = Y[i];
int mlt = 1;
int ans = 0;
for (int i=0;i<N;i++) {
mlt = mult(mlt,X[i]);
ans = max(ans,mlt*Y[i]);
}
return ans;
}
int32_t updateX(int32_t pos, int32_t val) {
x[pos] = val;
int mlt = 1;
int ans = 0;
for (int i=0;i<N;i++) {
mlt = mult(mlt,x[i]);
ans = max(ans,mlt*y[i]);
}
return ans;
}
int32_t updateY(int32_t pos, int32_t val) {
y[pos] = val;
int mlt = 1;
int ans = 0;
for (int i=0;i<N;i++) {
mlt = mult(mlt,x[i]);
ans = max(ans,mlt*y[i]);
}
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... |