Submission #951638

#TimeUsernameProblemLanguageResultExecution timeMemory
951638LittleOrangeFish 2 (JOI22_fish2)C++17
5 / 100
4049 ms1884 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(0);cin.tie(0); ll n; cin >> n; vector<ll> a(n); for(ll &i : a) cin >> i; ll q; cin >> q; while(q--){ ll ty; cin >> ty; if(ty==1){ ll x,y; cin >> x >> y; a[x-1] = y; }else{ ll l,r; cin >> l >> r; l--;r--; ll ans = 0; for(ll i = l;i<=r;i++){ ll L = i-1,R=i+1; ll cur = a[i]; while(true){ if (L>=l&&a[L]<=cur) cur += a[L--]; else if(R<=r&&a[R]<=cur) cur += a[R++]; else break; } ans += L==l-1&&R==r+1; } cout << ans << "\n"; } } }
#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...