# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1053791 | Osplei | Horses (IOI15_horses) | C++17 | 915 ms | 524288 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;
typedef int ll;
typedef pair <ll, ll> LL;
#define F first
#define S second
ll mod = 1e9 + 7;
int init(int N, int X[], int Y[]) {
//pos ans tengo
queue <pair <ll, LL>> q;
ll ans = 0;
q.push({-1, {0, 1}});
while (!q.empty()) {
pair <ll, LL> act;
act = q.front();
ans = max(ans, act.S.F);
q.pop();
if (act.F + 1 >= N) continue;
q.push({act.F + 1, {act.S.F % mod, (act.S.S * X[act.F + 1]) % mod}});
q.push({act.F + 1, {((act.S.F % mod) + (((((act.S.S * X[act.F + 1]) % mod) - 1) * Y[act.F + 1]) % mod)) % mod, 1}});
ans = max(ans, ((act.S.F % mod) + ((((act.S.S * X[act.F + 1]) % mod) * Y[act.F + 1]) % mod)) % mod);
}
return ans % mod;
}
int updateX(int pos, int val) {
return 0;
}
int updateY(int pos, int val) {
return 0;
}
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... |