Submission #909529

#TimeUsernameProblemLanguageResultExecution timeMemory
909529Tuanlinh123Fish 2 (JOI22_fish2)C++17
100 / 100
946 ms56404 KiB
#include<bits/stdc++.h> #define ll long long #define pll pair<ll, ll> #define pb push_back #define mp make_pair #define fi first #define se second #define ld long double using namespace std; ll x[100005]; struct SegTree { struct Node { ll ans=0, sum=0, len; vector <pair<ll, pll>> pre, suf; Node(){} Node(ll x) { ans=1, sum=x, len=1; pre.pb({0, {x, 0}}); suf.pb({0, {x, 0}}); } }; Node Merge(Node a, Node b) { Node ans; ans.sum=a.sum+b.sum, ans.len=a.len+b.len; ans.pre=vector <pair<ll, pll>> (a.pre.begin(), a.pre.end()); ans.suf=vector <pair<ll, pll>> (b.suf.begin(), b.suf.end()); ll resa=a.ans, resb=b.ans, reqa=0, reqb=0; for (pair<ll, pll> p:a.suf) reqb=max(reqb, p.se.fi-p.fi); for (pair<ll, pll> p:b.pre) reqa=max(reqa, p.se.fi-p.fi); ll s=0, ptra=0, ptrb=0; for (ll i=0; i<b.pre.size(); i++) { pair<ll, pll> p=b.pre[i]; if (a.sum+p.fi<p.se.fi) { while (ptrb<=i) { while (1) { if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi) ptrb++, s+=b.pre[ptrb].se.se; else if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi) ptra++; else break; } if (ptrb==i) { ans.pre.pb({a.sum+p.fi, {p.se.fi, (ptra==a.suf.size()?s:0)}}); break; } ptrb++, s=(ptrb==b.pre.size()?b.ans:b.pre[ptrb].se.se); } if (resa) { ll ptra=0, ptrb=0, s=0; resa=0; while (1) { while (1) { if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi) ptra++, s+=ptra==a.suf.size()?a.ans:a.suf[ptra].se.se; else if (ptrb<i && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi) ptrb++; else break; } if (ptra==a.suf.size()) { if (ptrb==i) ans.pre.back().se.se+=s; break; } ptra++, s=ptra==a.suf.size()?a.ans:a.suf[ptra].se.se; } } } } ptra=0, ptrb=0, s=0; for (ll i=0; i<a.suf.size(); i++) { pair<ll, pll> p=a.suf[i]; if (p.fi+b.sum<p.se.fi) { while (ptra<=i) { while (1) { if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi) ptra++, s+=a.suf[ptra].se.se; else if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi) ptrb++; else break; } if (ptra==i) { ans.suf.pb({p.fi+b.sum, {p.se.fi, (ptrb==b.pre.size()?s:0)}}); break; } ptra++, s=(ptra==a.suf.size()?a.ans:a.suf[ptra].se.se); } if (resb) { ll ptra=0, ptrb=0, s=0; resb=0; while (1) { while (1) { if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi) ptrb++, s+=ptrb==b.pre.size()?b.ans:b.pre[ptrb].se.se; else if (ptra<i && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi) ptra++; else break; } if (ptrb==b.pre.size()) { if (ptra==i) ans.suf.back().se.se+=s; break; } ptrb++, s=ptrb==b.pre.size()?b.ans:b.pre[ptrb].se.se; } } } } ptra=0, ptrb=0, s=0; while (1) { while (1) { if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi) ptra++, s+=ptra==a.suf.size()?a.ans:a.suf[ptra].se.se; else if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi) ptrb++; else break; } if (ptra==a.suf.size()) { if (ptrb==b.pre.size()) ans.ans+=s; break; } ptra++, s=ptra==a.suf.size()?a.ans:a.suf[ptra].se.se; } ptra=0, ptrb=0, s=0; while (1) { while (1) { if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi) ptrb++, s+=ptrb==b.pre.size()?b.ans:b.pre[ptrb].se.se; else if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi) ptra++; else break; } if (ptrb==b.pre.size()) { if (ptra==a.suf.size()) ans.ans+=s; break; } ptrb++, s=ptrb==b.pre.size()?b.ans:b.pre[ptrb].se.se; } // if (a.len!=0 && b.len!=0) // { // cout << a.len << " " << b.len << " " << a.ans << " " << b.ans << " " << a.sum << " " << b.sum << "\n"; // for (pair<ll, pll> i:a.suf) cout << i.fi << " " << i.se.fi << " " << i.se.se << "\n"; // for (pair<ll, pll> i:b.pre) cout << i.fi << " " << i.se.fi << " " << i.se.se << "\n"; // cout << "ans " << resa << " " << resb << " " << ans.ans << "\n"; // cout << "=>\n"; // for (pair<ll, pll> i:ans.pre) cout << i.fi << " " << i.se.fi << " " << i.se.se << "\n"; // } return ans; } void build(ll i, ll Start, ll End) { if (Start==End) { St[i]=Node(x[Start]); return; } ll mid=(Start+End)/2; build(i*2, Start, mid); build(i*2+1, mid+1, End); St[i]=Merge(St[i*2], St[i*2+1]); } ll n; vector <Node> St; SegTree (ll n): n(n) { St.resize(n*4+1); build(1, 1, n); } void update(ll i, ll Start, ll End, ll idx, ll x) { if (Start>idx || End<idx) return; if (Start==End) { St[i]=Node(x); return; } ll mid=(Start+End)/2; update(i*2, Start, mid, idx, x); update(i*2+1, mid+1, End, idx, x); St[i]=Merge(St[i*2], St[i*2+1]); } Node query(ll i, ll Start, ll End, ll l, ll r) { if (Start>=l && End<=r) return St[i]; ll mid=(Start+End)/2; if (mid<l) return query(i*2+1, mid+1, End, l, r); if (mid+1>r) return query(i*2, Start, mid, l, r); return Merge(query(i*2, Start, mid, l, r), query(i*2+1, mid+1, End, l, r)); } }; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; cin >> n; for (ll i=1; i<=n; i++) cin >> x[i]; SegTree A(n); ll q; cin >> q; for (ll i=1; i<=q; i++) { ll t, a, b; cin >> t >> a >> b; if (t==1) A.update(1, 1, n, a, b); else cout << A.query(1, 1, n, a, b).ans << "\n"; } }

Compilation message (stderr)

fish2.cpp: In member function 'SegTree::Node SegTree::Merge(SegTree::Node, SegTree::Node)':
fish2.cpp:41:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         for (ll i=0; i<b.pre.size(); i++)
      |                      ~^~~~~~~~~~~~~
fish2.cpp:50:33: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |                         if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi)
      |                             ~~~~^~~~~~~~~~~~~
fish2.cpp:50:70: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |                         if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi)
      |                                                                  ~~~~^~~~~~~~~~~~~~
fish2.cpp:52:38: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |                         else if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi)
      |                                  ~~~~^~~~~~~~~~~~~
fish2.cpp:52:75: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |                         else if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi)
      |                                                                       ~~~~^~~~~~~~~~~~~~
fish2.cpp:58:64: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |                         ans.pre.pb({a.sum+p.fi, {p.se.fi, (ptra==a.suf.size()?s:0)}});
      |                                                            ~~~~^~~~~~~~~~~~~~
fish2.cpp:61:36: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |                     ptrb++, s=(ptrb==b.pre.size()?b.ans:b.pre[ptrb].se.se);
      |                                ~~~~^~~~~~~~~~~~~~
fish2.cpp:70:37: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |                             if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi)
      |                                 ~~~~^~~~~~~~~~~~~
fish2.cpp:70:74: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |                             if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi)
      |                                                                      ~~~~^~~~~~~~~~~~~~
fish2.cpp:71:48: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |                                 ptra++, s+=ptra==a.suf.size()?a.ans:a.suf[ptra].se.se;
      |                                            ~~~~^~~~~~~~~~~~~~
fish2.cpp:72:68: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |                             else if (ptrb<i && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi)
      |                                                                ~~~~^~~~~~~~~~~~~~
fish2.cpp:76:33: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   76 |                         if (ptra==a.suf.size())
      |                             ~~~~^~~~~~~~~~~~~~
fish2.cpp:81:39: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   81 |                         ptra++, s=ptra==a.suf.size()?a.ans:a.suf[ptra].se.se;
      |                                   ~~~~^~~~~~~~~~~~~~
fish2.cpp:88:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   88 |         for (ll i=0; i<a.suf.size(); i++)
      |                      ~^~~~~~~~~~~~~
fish2.cpp:97:33: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   97 |                         if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi)
      |                             ~~~~^~~~~~~~~~~~~
fish2.cpp:97:70: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   97 |                         if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi)
      |                                                                  ~~~~^~~~~~~~~~~~~~
fish2.cpp:99:38: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   99 |                         else if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi)
      |                                  ~~~~^~~~~~~~~~~~~
fish2.cpp:99:75: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   99 |                         else if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi)
      |                                                                       ~~~~^~~~~~~~~~~~~~
fish2.cpp:105:64: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  105 |                         ans.suf.pb({p.fi+b.sum, {p.se.fi, (ptrb==b.pre.size()?s:0)}});
      |                                                            ~~~~^~~~~~~~~~~~~~
fish2.cpp:108:36: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  108 |                     ptra++, s=(ptra==a.suf.size()?a.ans:a.suf[ptra].se.se);
      |                                ~~~~^~~~~~~~~~~~~~
fish2.cpp:117:37: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  117 |                             if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi)
      |                                 ~~~~^~~~~~~~~~~~~
fish2.cpp:117:74: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  117 |                             if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi)
      |                                                                      ~~~~^~~~~~~~~~~~~~
fish2.cpp:118:48: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  118 |                                 ptrb++, s+=ptrb==b.pre.size()?b.ans:b.pre[ptrb].se.se;
      |                                            ~~~~^~~~~~~~~~~~~~
fish2.cpp:119:68: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  119 |                             else if (ptra<i && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi)
      |                                                                ~~~~^~~~~~~~~~~~~~
fish2.cpp:123:33: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  123 |                         if (ptrb==b.pre.size())
      |                             ~~~~^~~~~~~~~~~~~~
fish2.cpp:128:39: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  128 |                         ptrb++, s=ptrb==b.pre.size()?b.ans:b.pre[ptrb].se.se;
      |                                   ~~~~^~~~~~~~~~~~~~
fish2.cpp:139:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  139 |                 if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi)
      |                     ~~~~^~~~~~~~~~~~~
fish2.cpp:139:62: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  139 |                 if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi)
      |                                                          ~~~~^~~~~~~~~~~~~~
fish2.cpp:140:36: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  140 |                     ptra++, s+=ptra==a.suf.size()?a.ans:a.suf[ptra].se.se;
      |                                ~~~~^~~~~~~~~~~~~~
fish2.cpp:141:30: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  141 |                 else if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi)
      |                          ~~~~^~~~~~~~~~~~~
fish2.cpp:141:67: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  141 |                 else if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi)
      |                                                               ~~~~^~~~~~~~~~~~~~
fish2.cpp:145:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  145 |             if (ptra==a.suf.size())
      |                 ~~~~^~~~~~~~~~~~~~
fish2.cpp:147:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  147 |                 if (ptrb==b.pre.size())
      |                     ~~~~^~~~~~~~~~~~~~
fish2.cpp:151:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  151 |             ptra++, s=ptra==a.suf.size()?a.ans:a.suf[ptra].se.se;
      |                       ~~~~^~~~~~~~~~~~~~
fish2.cpp:158:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  158 |                 if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi)
      |                     ~~~~^~~~~~~~~~~~~
fish2.cpp:158:62: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  158 |                 if (ptrb<b.pre.size() && b.pre[ptrb].fi+(ptra==a.suf.size()?a.sum:a.suf[ptra].fi)>=b.pre[ptrb].se.fi)
      |                                                          ~~~~^~~~~~~~~~~~~~
fish2.cpp:159:36: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  159 |                     ptrb++, s+=ptrb==b.pre.size()?b.ans:b.pre[ptrb].se.se;
      |                                ~~~~^~~~~~~~~~~~~~
fish2.cpp:160:30: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  160 |                 else if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi)
      |                          ~~~~^~~~~~~~~~~~~
fish2.cpp:160:67: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  160 |                 else if (ptra<a.suf.size() && a.suf[ptra].fi+(ptrb==b.pre.size()?b.sum:b.pre[ptrb].fi)>=a.suf[ptra].se.fi)
      |                                                               ~~~~^~~~~~~~~~~~~~
fish2.cpp:164:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  164 |             if (ptrb==b.pre.size())
      |                 ~~~~^~~~~~~~~~~~~~
fish2.cpp:166:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  166 |                 if (ptra==a.suf.size())
      |                     ~~~~^~~~~~~~~~~~~~
fish2.cpp:170:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  170 |             ptrb++, s=ptrb==b.pre.size()?b.ans:b.pre[ptrb].se.se;
      |                       ~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...