# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1053784 | Osplei | 말 (IOI15_horses) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <ll, ll> LL;
#define F first
#define S second
ll mod = 1e9 + 7;
ll init(ll N, ll X[], ll 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();
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, 1LL}});
q.push({act.F + 1, {((act.S.F % mod) + ((((act.S.S * X[act.F + 1]) % mod) * Y[act.F + 1]) % mod)) % mod, 0LL}});
}
return ans % mod;
}
int updateX(int pos, int val) {
return 0;
}
int updateY(int pos, int val) {
return 0;
}