# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
851978 | ntkphong | Horses (IOI15_horses) | C++14 | 0 ms | 0 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;
const int lim = 1e9;
const int mod = 1e9 + 7;
const int mxN = 5e5 + 10;
int n;
int aX[mxN], aY[mxN];
pair<int, int> ST[mxN << 2];
map<int, int> mp;
void update(int node, int l, int r, int x) {
if(r < x || x < l) return ;
if(l == r) {
ST[node].first = aX[l];
ST[node].second = aY[l];
return ;
}
int mid = (l + r) / 2;
update(node * 2, l, mid, x);
update(node * 2 + 1, mid + 1, r, x);
ST[node].first = (1LL * ST[node * 2].first * ST[node * 2 + 1].first) % mod;
ST[node].second = max(ST[node * 2].second, ST[node * 2 + 1].second);
}