Submission #376820

# Submission time Handle Problem Language Result Execution time Memory
376820 2021-03-12T05:02:36 Z YJU Bitaro, who Leaps through Time (JOI19_timeleap) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector,Ofast")
using namespace std;
typedef int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll N=3e5+5;
const ll INF=(1LL<<29);
const ld pi=acos(-1);
const ll MOD=1e9+7;
#define REP(i,n) for(int i=0;i<n;++i)
#define REP1(i,n) for(int i=1;i<=n;++i)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lwb lower_bound
#define setp setprecision
#define SZ(_a) (ll)_a.size()

struct ele{
	ll ty,a,b,c;
	//ele(ll _ty,ll _a,ll _b,ll _c):ty(_ty),a(_a),b(_b),c(_c){};
	void out(){
		cout<<ty<<" "<<a<<" "<<b<<" "<<c<<"\n";
	}
};

ele operator +(ele A,ele B){
	if(A.ty==1){
        if(B.ty==1){
			if(A.a>B.b)return ele{2,A.a,B.b,A.c+B.c+(A.a-B.b)};
			else if(A.b<B.a)return ele{2,A.b,B.a,A.c+B.c};
			else return ele{1,max(A.a,B.a),min(A.b,B.b),A.c+B.c};
        }else{
            if(B.a<=A.b&&A.a<=B.a)return ele{2,B.a,B.b,A.c+B.c};
            else if(A.b<B.a)return ele{2,A.b,B.b,A.c+B.c};
            else if(A.a>B.a)return ele{2,A.a,B.b,A.c+B.c+(A.a-B.a)};
        }
	}else{
		if(B.ty==1){
			if(A.b<=B.b&&A.b>=B.a)return ele{2,A.a,A.b,A.c+B.c};
			else if(A.b>B.b)return ele{2,A.a,B.b,A.c+B.c+(A.b-B.b)};
			else if(A.b<B.a)return ele{2,A.a,B.a,A.c+B.c};
		}else{
            return ele{2,A.a,B.b,A.c+B.c+max(A.b-B.a,0LL)};
		}
	}
}

ll L[N],R[N];
ll n,q,x,ans[N];
vector<ll> input[N];
vector<ele> seg(4*N);

void rev(){
	reverse(L+1,L+n);
	reverse(R+1,R+n);
	REP1(i,q){
        if(input[i][0]==1){
            input[i][1]=n-input[i][1];
		}else{
            input[i][1]=n+1-input[i][1];
            input[i][3]=n+1-input[i][3];
		}
	}
}

void build(ll id,ll l,ll r){
	if(l==r-1){seg[id]=ele{1,L[l]-l,R[l]-l-1,0};return ;}
	ll mid=(l+r)>>1;
	build(id*2,l,mid);
	build(id*2+1,mid,r);
	seg[id]=seg[id*2]+seg[id*2+1];
}

void upd(ll id,ll l,ll r,ll to,ele d){
    if(l==r-1){seg[id]=d;return ;}
    ll mid=(l+r)>>1;
    if(to<mid){
		upd(id*2,l,mid,to,d);
    }else{
		upd(id*2+1,mid,r,to,d);
    }
    seg[id]=seg[id*2]+seg[id*2+1];
}

ele query(ll id,ll l,ll r,ll ql,ll qr){
	if(l>=ql&&r<=qr)return seg[id];
    ll mid=(l+r)>>1;
    if(mid>=qr)return query(id*2,l,mid,ql,qr);
    if(mid<=ql)return query(id*2+1,mid,r,ql,qr);
    return query(id*2,l,mid,ql,qr)+query(id*2+1,mid,r,ql,qr);
}

void solve(){
	seg.resize(4*N);
	build(1,1,n);
    //REP1(i,n-1)seg[i]=ele{1,L[i]-i,R[i]-i-1,0};

	REP1(i,q){
		ll T=input[i][0];
        if(T==1){
			ll P=input[i][1],NL=input[i][2],NR=input[i][3];
			upd(1,1,n,P,ele{1,NL-P,NR-P-1,0});
			//seg[P]=ele{1,NL-P,NR-P-1,0};
        }else{
			ll A=input[i][1],B=input[i][2],C=input[i][3],D=input[i][4];
			if(A>C)continue;
			if(A==C){ans[i]=max(B-D,0LL);continue;}

			ele sum=query(1,1,n,A,C);

			B-=A,D-=C;
            if(sum.ty==1){
				ans[i]=sum.c+max(0LL,B-sum.b)+max(0LL,max(sum.a,min(B,sum.b))-D);
            }else{
				ans[i]=sum.c+max(0LL,B-sum.a)+max(0LL,sum.b-D);
            }
        }
	}
}

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	memset(ans,-1,sizeof(ans));
    cin>>n>>q;
    REP1(i,n-1)cin>>L[i]>>R[i];
    REP1(i,q){
		cin>>x;input[i].pb(x);
		if(x==1)REP(j,3)cin>>x,input[i].pb(x);
		else REP(j,4)cin>>x,input[i].pb(x);
    }
    solve();
    rev();
    solve();
    REP1(i,q)if(ans[i]!=-1)cout<<ans[i]<<"\n";
	return 0;
}

Compilation message

timeleap.cpp: In function 'ele operator+(ele, ele)':
timeleap.cpp:46:57: error: no matching function for call to 'max(ll, long long int)'
   46 |             return ele{2,A.a,B.b,A.c+B.c+max(A.b-B.a,0LL)};
      |                                                         ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:222:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  222 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:222:5: note:   template argument deduction/substitution failed:
timeleap.cpp:46:57: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   46 |             return ele{2,A.a,B.b,A.c+B.c+max(A.b-B.a,0LL)};
      |                                                         ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:268:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  268 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:268:5: note:   template argument deduction/substitution failed:
timeleap.cpp:46:57: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   46 |             return ele{2,A.a,B.b,A.c+B.c+max(A.b-B.a,0LL)};
      |                                                         ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3456 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
timeleap.cpp:46:57: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   46 |             return ele{2,A.a,B.b,A.c+B.c+max(A.b-B.a,0LL)};
      |                                                         ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
timeleap.cpp:46:57: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   46 |             return ele{2,A.a,B.b,A.c+B.c+max(A.b-B.a,0LL)};
      |                                                         ^
timeleap.cpp: In function 'void solve()':
timeleap.cpp:110:31: error: no matching function for call to 'max(ll, long long int)'
  110 |    if(A==C){ans[i]=max(B-D,0LL);continue;}
      |                               ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:222:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  222 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:222:5: note:   template argument deduction/substitution failed:
timeleap.cpp:110:31: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
  110 |    if(A==C){ans[i]=max(B-D,0LL);continue;}
      |                               ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:268:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  268 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:268:5: note:   template argument deduction/substitution failed:
timeleap.cpp:110:31: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
  110 |    if(A==C){ans[i]=max(B-D,0LL);continue;}
      |                               ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3456 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
timeleap.cpp:110:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  110 |    if(A==C){ans[i]=max(B-D,0LL);continue;}
      |                               ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
timeleap.cpp:110:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  110 |    if(A==C){ans[i]=max(B-D,0LL);continue;}
      |                               ^
timeleap.cpp:116:33: error: no matching function for call to 'max(long long int, ll)'
  116 |     ans[i]=sum.c+max(0LL,B-sum.b)+max(0LL,max(sum.a,min(B,sum.b))-D);
      |                                 ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:222:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  222 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:222:5: note:   template argument deduction/substitution failed:
timeleap.cpp:116:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'll' {aka 'int'})
  116 |     ans[i]=sum.c+max(0LL,B-sum.b)+max(0LL,max(sum.a,min(B,sum.b))-D);
      |                                 ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:268:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  268 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:268:5: note:   template argument deduction/substitution failed:
timeleap.cpp:116:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'll' {aka 'int'})
  116 |     ans[i]=sum.c+max(0LL,B-sum.b)+max(0LL,max(sum.a,min(B,sum.b))-D);
      |                                 ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3456 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
timeleap.cpp:116:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  116 |     ans[i]=sum.c+max(0LL,B-sum.b)+max(0LL,max(sum.a,min(B,sum.b))-D);
      |                                 ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
timeleap.cpp:116:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  116 |     ans[i]=sum.c+max(0LL,B-sum.b)+max(0LL,max(sum.a,min(B,sum.b))-D);
      |                                 ^
timeleap.cpp:116:68: error: no matching function for call to 'max(long long int, int)'
  116 |     ans[i]=sum.c+max(0LL,B-sum.b)+max(0LL,max(sum.a,min(B,sum.b))-D);
      |                                                                    ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:222:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  222 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:222:5: note:   template argument deduction/substitution failed:
timeleap.cpp:116:68: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
  116 |     ans[i]=sum.c+max(0LL,B-sum.b)+max(0LL,max(sum.a,min(B,sum.b))-D);
      |                                                                    ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:268:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  268 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:268:5: note:   template argument deduction/substitution failed:
timeleap.cpp:116:68: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
  116 |     ans[i]=sum.c+max(0LL,B-sum.b)+max(0LL,max(sum.a,min(B,sum.b))-D);
      |                                                                    ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3456 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
timeleap.cpp:116:68: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  116 |     ans[i]=sum.c+max(0LL,B-sum.b)+max(0LL,max(sum.a,min(B,sum.b))-D);
      |                                                                    ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
timeleap.cpp:116:68: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  116 |     ans[i]=sum.c+max(0LL,B-sum.b)+max(0LL,max(sum.a,min(B,sum.b))-D);
      |                                                                    ^
timeleap.cpp:118:33: error: no matching function for call to 'max(long long int, ll)'
  118 |     ans[i]=sum.c+max(0LL,B-sum.a)+max(0LL,sum.b-D);
      |                                 ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:222:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  222 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:222:5: note:   template argument deduction/substitution failed:
timeleap.cpp:118:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'll' {aka 'int'})
  118 |     ans[i]=sum.c+max(0LL,B-sum.a)+max(0LL,sum.b-D);
      |                                 ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:268:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  268 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:268:5: note:   template argument deduction/substitution failed:
timeleap.cpp:118:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'll' {aka 'int'})
  118 |     ans[i]=sum.c+max(0LL,B-sum.a)+max(0LL,sum.b-D);
      |                                 ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3456 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
timeleap.cpp:118:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  118 |     ans[i]=sum.c+max(0LL,B-sum.a)+max(0LL,sum.b-D);
      |                                 ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from timeleap.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
timeleap.cpp:118:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  118 |     ans[i]=sum.c+max(0LL,B-sum.a)+max(0LL,sum.b-D);
      |                                 ^
timeleap.cpp:118:50: error: no matching function for call to 'max(long long int, ll)'
  118 |     ans[i]=sum.c+max(0LL,B-sum.a)+max(0LL,sum.b-D);
      |                                                  ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from