| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 408904 | dxz05 | Horses (IOI15_horses) | C++14 | 86 ms | 14008 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>
typedef long double ld;
typedef long long ll;
using namespace std;
const int MAXN = 111111;
const int MOD = 1000000007;
int X[MAXN], Y[MAXN];
int N;
int calc(){
ld best = 0, mult = 0;
for (int i = 0; i < N; i++){
mult += log2(X[i]);
best = max(best, mult + log2(Y[i]));
}
ll ans = 1;
mult = 0;
for (int i = 0; i < N; i++){
mult += log2(X[i]);
ans = (ans * X[i]) % MOD;
if (mult + log2(Y[i]) == best){
ans = (ans * Y[i]) % MOD;
return ans;
}
}
return 0;
}
int init(int _N, int _X[], int _Y[]) {
N = _N;
for (int i = 0; i < N; i++){
X[i] = _X[i], Y[i] = _Y[i];
}
return calc();
}
int updateX(int pos, int val) {
X[pos] = val;
return calc();
}
int updateY(int pos, int val) {
Y[pos] = val;
return calc();
}
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... | ||||
