# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
939442 | Warinchai | Zoltan (COCI16_zoltan) | C++14 | 277 ms | 33416 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<bits/stdc++.h>
using namespace std;
int ar[200005];
int md=1e9+7;
struct node{
long long l,w;
node(int a=0,int b=1){
l=a,w=b;
}
friend node operator+(node a,node b){
node c;
c.l=max(a.l,b.l);
c.w=a.l==b.l?a.w+b.w:a.l>b.l?a.w:b.w;
if(c.l==0)c.w=1;
c.w%=md;
return c;
}
};
struct segtree{
node info[800005];
void upd(int st,int en,int i,int pos,int len,int way){
if(st>pos||en<pos)return;
if(st==en)return void(info[i]=info[i]+node(len,way));
int m=(st+en)/2;
upd(st,m,i*2,pos,len,way);
upd(m+1,en,i*2+1,pos,len,way);
info[i]=info[i*2]+info[i*2+1];
}
node fans(int st,int en,int i,int l,int r){
if(st>r||en<l)return node();
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |