# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
504099 | Deepesson | Zoltan (COCI16_zoltan) | C++17 | 322 ms | 17124 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>
#define MAX 205000
const long long MOD = 1e9+7;
typedef std::pair<long long,long long> pii;
typedef std::pair<int,int*> pipo;
///The first number is the size of the sequence, and the second one the number of sequences
pii comb(pii a,pii b){
if(a.first==b.first){
///I'm multiplying MOD by two because I will divide by two later
a.second%=(MOD*2);
b.second%=(MOD*2);
return {a.first,a.second+b.second%(MOD*2)};
}else return std::max(a,b);
}
///Basic seg3
pii tab[MAX*4][2]={};
pii query(int l,int r,int x,int la=0,int ra=MAX-1,int pos=1){
if(la>r||ra<l)return tab[0][x];
if(la>=l&&ra<=r){
return tab[pos][x];
}
int m = (la+ra)/2;
return comb(query(l,r,x,la,m,pos*2),query(l,r,x,m+1,ra,(pos*2)+1));
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |