| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 707681 | MODDI | Horses (IOI15_horses) | C++14 | 1578 ms | 9204 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>
#define ll long long
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
using namespace std;
const int mod = 1e9 + 7;
vi X, Y;
ll mul(ll a, ll b){
return (a * b) % mod;
}
int N;
int init(int n, int x[], int y[]){
N = n;
for(int i = 0; i < n; i++)
X.pb(x[i]);
for(int i = 0; i < n; i++)
Y.pb(y[i]);
ll ans = 0, mult = 1;
for(int i = 0; i < n; i++){
mult = mul(mult, X[i]);
ll cur_sell = mul(mult, Y[i]);
ans = max(ans, cur_sell);
}
if(ans < 0) assert(false);
return ans;
}
int updateX(int pos, int val){
X[pos] = val;
ll ans = 0, mult = 1;
for(int i = 0; i < N; i++){
mult = mul(mult, X[i]);
ll cur_sell = mul(mult, Y[i]);
ans = max(ans, cur_sell);
}
if(ans < 0) assert(false);
return ans;
}
int updateY(int pos, int val){
Y[pos] = val;
ll ans = 0, mult = 1;
for(int i = 0; i < N; i++){
mult = mul(mult, X[i]);
ll cur_sell = mul(mult, Y[i]);
ans = max(ans, cur_sell);
}
if(ans < 0) assert(false);
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... | ||||
