Submission #790928

#TimeUsernameProblemLanguageResultExecution timeMemory
790928eltu0815Fish 2 (JOI22_fish2)C++14
0 / 100
9 ms596 KiB
#include <bits/stdc++.h> #define MAX 500005 #define MOD (ll)(1e9+7) #define INF (ll)(1e18) #define inf (1987654321) using namespace std; typedef long long ll; typedef pair<ll, ll> pll; typedef pair<int, int> pii; int n, q; int arr[100005]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cin >> n; for(int i = 1; i <= n; ++i) cin >> arr[i]; cin >> q; while(q--) { int t, a, b; cin >> t >> a >> b; if(t == 1) arr[a] = b; else { ll cnt = 0; for(int i = a; i <= b; ++i) { int sz = arr[i], p = i - 1, q = i + 1; while(true) { if(q <= b && arr[q] <= sz) sz += arr[q++]; else if(p >= a && arr[p] <= sz) sz += arr[p--]; else break; } if(p == a - 1 && q == b + 1) ++cnt; } cout << cnt << '\n'; } } return 0; }
#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...