Submission #780193

# Submission time Handle Problem Language Result Execution time Memory
780193 2023-07-12T07:11:46 Z Dan4Life Fish 2 (JOI22_fish2) C++17
5 / 100
54 ms 468 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long 
int n, q, a[510];

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	cin >> q;
	while(q--){
		int t, l, r; cin >> t >> l >> r;
		if(t==1) a[l]=r;
		else{
			int ans = 0;
			for(int i = l; i <= r; i++){
				int cur = a[i], j=i-1,k=i+1;
				while((j>=l and cur>=a[j]) or (k<=r and cur>=a[k])){
					if(j>=l and cur>=a[j]) cur+=a[j--];
					if(k<=r and cur>=a[k]) cur+=a[k++];
				}
				if(cur==accumulate(a+l,a+r+1,0ll)) ans++;
			}
			cout << ans << "\n";
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 7 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 7 ms 212 KB Output is correct
9 Correct 16 ms 212 KB Output is correct
10 Correct 7 ms 328 KB Output is correct
11 Correct 21 ms 212 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 9 ms 212 KB Output is correct
14 Correct 4 ms 332 KB Output is correct
15 Correct 6 ms 328 KB Output is correct
16 Correct 23 ms 328 KB Output is correct
17 Correct 4 ms 336 KB Output is correct
18 Correct 11 ms 328 KB Output is correct
19 Correct 7 ms 340 KB Output is correct
20 Correct 54 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 468 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 7 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 7 ms 212 KB Output is correct
9 Correct 16 ms 212 KB Output is correct
10 Correct 7 ms 328 KB Output is correct
11 Correct 21 ms 212 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 9 ms 212 KB Output is correct
14 Correct 4 ms 332 KB Output is correct
15 Correct 6 ms 328 KB Output is correct
16 Correct 23 ms 328 KB Output is correct
17 Correct 4 ms 336 KB Output is correct
18 Correct 11 ms 328 KB Output is correct
19 Correct 7 ms 340 KB Output is correct
20 Correct 54 ms 312 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Runtime error 1 ms 468 KB Execution killed with signal 11
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 468 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 468 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 7 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 7 ms 212 KB Output is correct
9 Correct 16 ms 212 KB Output is correct
10 Correct 7 ms 328 KB Output is correct
11 Correct 21 ms 212 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 9 ms 212 KB Output is correct
14 Correct 4 ms 332 KB Output is correct
15 Correct 6 ms 328 KB Output is correct
16 Correct 23 ms 328 KB Output is correct
17 Correct 4 ms 336 KB Output is correct
18 Correct 11 ms 328 KB Output is correct
19 Correct 7 ms 340 KB Output is correct
20 Correct 54 ms 312 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Runtime error 1 ms 468 KB Execution killed with signal 11
23 Halted 0 ms 0 KB -