# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
742520 | Dan4Life | Horses (IOI15_horses) | C++17 | 372 ms | 56176 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;
using ll = long long;
const int mxN = (int)5e5+10;
const int MOD = (int)1e9+7;
struct Data{ double sum, ans; int i; } segTree[2*mxN];
ll n, X[mxN], Y[mxN], segTree2[2*mxN];
Data comb(Data &a, Data &b){
Data c = {a.sum+b.sum,a.ans,a.i};
if(a.ans <= a.sum+b.ans) c.i=b.i;
c.ans = max(a.ans, a.sum+b.ans);
return c;
}
void upd2(int x, ll v, int p=0, int l=0, int r=n-1){
if(l==r){ segTree2[p] = v; return; }
int mid = (l+r)/2; int rp = p+2*(mid-l+1);
if(x<=mid) upd2(x,v,p+1,l,mid);
else upd2(x,v,rp,mid+1,r);
segTree2[p] = (ll)((segTree2[p+1]*segTree2[rp])%MOD);
}
ll query(int i, int j, int p=0, int l=0, int r=n-1){
if(i>r or j<l or i>j) return 1ll;
if(i<=l and r<=j) return segTree2[p];
int mid = (l+r)/2; int rp = p+2*(mid-l+1);
return (query(i,j,p+1,l,mid)*query(i,j,rp,mid+1,r))%MOD;
}
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... |