# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
865875 | LittleOrange | Bitaro, who Leaps through Time (JOI19_timeleap) | C++17 | 711 ms | 156792 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;
using ll = long long;
struct obj{
ll l0,r0,l1,r1,c,m0,m1;
obj(ll a,ll b, ll c, ll d, ll e, ll f, ll g):l0(a),r0(b),l1(c),r1(d),c(e),m0(f),m1(g){}
obj(ll l, ll r):l0(l),r0(r-1),l1(l+1),r1(r),c(0),m0(l),m1(r-1){}
obj():l0(0),r0(0),l1(0),r1(0),c(0),m0(0),m1(0){}
ll cal(ll a, ll b) const{
ll ans = 0;
a = max(a,l0);
if (a>r0){
ans += a-r0;
a = r0;
}
if (l1==r1){
if (a<=m0) ans += c;
else ans += c + a-m0;
if (b<l1) ans += l1-b;
}else{
if (a>=m1) ans += a-m1;
ll ot = max(min(a,m1),m0)-m0+l1;
if (b<ot) ans += ot-b;
}
return ans;
}
obj operator+(const obj &o) const{
if (l1==r1){
if (o.l1==o.r1){
return obj(l0,r0,o.l1,o.r1,c+o.cal(l1+0,o.l1),m0,m1);
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... |