Submission #951638

# Submission time Handle Problem Language Result Execution time Memory
951638 2024-03-22T08:16:42 Z LittleOrange Fish 2 (JOI22_fish2) C++17
5 / 100
4000 ms 1884 KB
#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 time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 452 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 4 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 6 ms 472 KB Output is correct
10 Correct 6 ms 344 KB Output is correct
11 Correct 11 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 2 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 8 ms 468 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 3 ms 344 KB Output is correct
19 Correct 4 ms 348 KB Output is correct
20 Correct 28 ms 472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 449 ms 1628 KB Output is correct
3 Correct 78 ms 1368 KB Output is correct
4 Correct 395 ms 1628 KB Output is correct
5 Correct 64 ms 1368 KB Output is correct
6 Execution timed out 4049 ms 1884 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 452 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 4 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 6 ms 472 KB Output is correct
10 Correct 6 ms 344 KB Output is correct
11 Correct 11 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 2 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 8 ms 468 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 3 ms 344 KB Output is correct
19 Correct 4 ms 348 KB Output is correct
20 Correct 28 ms 472 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 449 ms 1628 KB Output is correct
23 Correct 78 ms 1368 KB Output is correct
24 Correct 395 ms 1628 KB Output is correct
25 Correct 64 ms 1368 KB Output is correct
26 Execution timed out 4049 ms 1884 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 449 ms 1628 KB Output is correct
3 Correct 78 ms 1368 KB Output is correct
4 Correct 395 ms 1628 KB Output is correct
5 Correct 64 ms 1368 KB Output is correct
6 Execution timed out 4049 ms 1884 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 449 ms 1628 KB Output is correct
3 Correct 78 ms 1368 KB Output is correct
4 Correct 395 ms 1628 KB Output is correct
5 Correct 64 ms 1368 KB Output is correct
6 Execution timed out 4049 ms 1884 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 452 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 4 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 6 ms 472 KB Output is correct
10 Correct 6 ms 344 KB Output is correct
11 Correct 11 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 2 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 8 ms 468 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 3 ms 344 KB Output is correct
19 Correct 4 ms 348 KB Output is correct
20 Correct 28 ms 472 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 449 ms 1628 KB Output is correct
23 Correct 78 ms 1368 KB Output is correct
24 Correct 395 ms 1628 KB Output is correct
25 Correct 64 ms 1368 KB Output is correct
26 Execution timed out 4049 ms 1884 KB Time limit exceeded
27 Halted 0 ms 0 KB -