# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1046932 | 2024-08-07T06:31:34 Z | dpsaveslives | Horses (IOI15_horses) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> #define ll long long using namespace std; const int MAXN = 5e5+1; const int MOD = 1e9+7; int x[MAXN], y[MAXN]; ll init(int N, int X[], int Y[]){ ll cur = 1ll, ans = 1ll; for(int i = 0;i<N;++i){ x[i] = X[i]; y[i] = Y[i]; cur = cur*X[i]%MOD; ans = max(ans,cur*Y[i]%MOD); } return ans; } ll updateX(int pos, int val){ x[pos] = val; ll cur = 1ll, ans = 1ll; for(int i = 0;i<N;++i){ cur = cur*x[i]%MOD; ans = max(ans,cur*y[i]%MOD); } return ans; } ll updateY(int pos, int val){ y[pos] = val; ll cur = 1ll, ans = 1ll; for(int i = 0;i<N;++i){ cur = cur*x[i]%MOD; ans = max(ans,cur*y[i]%MOD); } return ans; }