# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
818594 | 2023-08-10T05:39:46 Z | 반딧불(#10131) | Fish 2 (JOI22_fish2) | C++17 | 4000 ms | 3648 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e18; int n, q; ll arr[100002]; ll sum[100002]; ll chk[100002]; void solve(int s, int e){ for(int i=1; i<=n; i++) sum[i] = sum[i-1] + arr[i], chk[i] = 0; vector<pair<int, ll> > vec; vec.push_back(make_pair(s-1, INF)); for(int i=s; i<=e+1; i++){ while(!vec.empty() && vec.back().second <= (i==e+1?INF:arr[i])){ int l = vec.back().first, r = i; if(l==s-1 && r==e+1) break; vec.pop_back(); if(sum[r-1] - sum[l] < min(l==s-1?INF:arr[l], r==e+1?INF:arr[r])) chk[l+1]++, chk[r]--; } int l = vec.back().first, r = i; if(!(l==s-1 && r==e+1) && sum[r-1] - sum[l] < min(l==s-1?INF:arr[l], r==e+1?INF:arr[r])) chk[l+1]++, chk[r]--; vec.push_back(make_pair(i, arr[i])); } for(int i=1; i<=n; i++) chk[i] += chk[i-1]; int ret = 0; for(int i=s; i<=e; i++) if(!chk[i]) ret++; printf("%d\n", ret); } int main(){ scanf("%d", &n); for(int i=1; i<=n; i++) scanf("%lld", &arr[i]); scanf("%d", &q); for(int i=1; i<=q; i++){ int t, x, y; scanf("%d %d %d", &t, &x, &y); if(t==1) arr[x] = y; else solve(x, y); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 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 | 1 ms | 212 KB | Output is correct |
6 | Correct | 2 ms | 312 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 3 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 3 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 3 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 3 ms | 212 KB | Output is correct |
19 | Correct | 2 ms | 312 KB | Output is correct |
20 | Correct | 5 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 308 KB | Output is correct |
2 | Correct | 11 ms | 3156 KB | Output is correct |
3 | Correct | 10 ms | 2900 KB | Output is correct |
4 | Correct | 11 ms | 3164 KB | Output is correct |
5 | Correct | 14 ms | 2900 KB | Output is correct |
6 | Correct | 12 ms | 3540 KB | Output is correct |
7 | Correct | 10 ms | 2760 KB | Output is correct |
8 | Correct | 12 ms | 3616 KB | Output is correct |
9 | Correct | 15 ms | 2772 KB | Output is correct |
10 | Correct | 12 ms | 3136 KB | Output is correct |
11 | Correct | 11 ms | 2900 KB | Output is correct |
12 | Correct | 13 ms | 2904 KB | Output is correct |
13 | Correct | 10 ms | 2884 KB | Output is correct |
14 | Correct | 16 ms | 3156 KB | Output is correct |
15 | Correct | 11 ms | 3160 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 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 | 1 ms | 212 KB | Output is correct |
6 | Correct | 2 ms | 312 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 3 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 3 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 3 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 3 ms | 212 KB | Output is correct |
19 | Correct | 2 ms | 312 KB | Output is correct |
20 | Correct | 5 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 308 KB | Output is correct |
22 | Correct | 11 ms | 3156 KB | Output is correct |
23 | Correct | 10 ms | 2900 KB | Output is correct |
24 | Correct | 11 ms | 3164 KB | Output is correct |
25 | Correct | 14 ms | 2900 KB | Output is correct |
26 | Correct | 12 ms | 3540 KB | Output is correct |
27 | Correct | 10 ms | 2760 KB | Output is correct |
28 | Correct | 12 ms | 3616 KB | Output is correct |
29 | Correct | 15 ms | 2772 KB | Output is correct |
30 | Correct | 12 ms | 3136 KB | Output is correct |
31 | Correct | 11 ms | 2900 KB | Output is correct |
32 | Correct | 13 ms | 2904 KB | Output is correct |
33 | Correct | 10 ms | 2884 KB | Output is correct |
34 | Correct | 16 ms | 3156 KB | Output is correct |
35 | Correct | 11 ms | 3160 KB | Output is correct |
36 | Correct | 484 ms | 3220 KB | Output is correct |
37 | Correct | 717 ms | 2980 KB | Output is correct |
38 | Correct | 871 ms | 2976 KB | Output is correct |
39 | Correct | 210 ms | 3156 KB | Output is correct |
40 | Correct | 918 ms | 2984 KB | Output is correct |
41 | Correct | 831 ms | 3612 KB | Output is correct |
42 | Correct | 983 ms | 3608 KB | Output is correct |
43 | Correct | 752 ms | 2852 KB | Output is correct |
44 | Correct | 926 ms | 2852 KB | Output is correct |
45 | Correct | 485 ms | 3208 KB | Output is correct |
46 | Correct | 674 ms | 3216 KB | Output is correct |
47 | Correct | 931 ms | 2920 KB | Output is correct |
48 | Correct | 311 ms | 2892 KB | Output is correct |
49 | Correct | 997 ms | 2900 KB | Output is correct |
50 | Correct | 519 ms | 3244 KB | Output is correct |
51 | Correct | 1606 ms | 3248 KB | Output is correct |
52 | Correct | 1886 ms | 3244 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 308 KB | Output is correct |
2 | Correct | 11 ms | 3156 KB | Output is correct |
3 | Correct | 10 ms | 2900 KB | Output is correct |
4 | Correct | 11 ms | 3164 KB | Output is correct |
5 | Correct | 14 ms | 2900 KB | Output is correct |
6 | Correct | 12 ms | 3540 KB | Output is correct |
7 | Correct | 10 ms | 2760 KB | Output is correct |
8 | Correct | 12 ms | 3616 KB | Output is correct |
9 | Correct | 15 ms | 2772 KB | Output is correct |
10 | Correct | 12 ms | 3136 KB | Output is correct |
11 | Correct | 11 ms | 2900 KB | Output is correct |
12 | Correct | 13 ms | 2904 KB | Output is correct |
13 | Correct | 10 ms | 2884 KB | Output is correct |
14 | Correct | 16 ms | 3156 KB | Output is correct |
15 | Correct | 11 ms | 3160 KB | Output is correct |
16 | Correct | 0 ms | 304 KB | Output is correct |
17 | Execution timed out | 4051 ms | 3388 KB | Time limit exceeded |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 308 KB | Output is correct |
2 | Correct | 11 ms | 3156 KB | Output is correct |
3 | Correct | 10 ms | 2900 KB | Output is correct |
4 | Correct | 11 ms | 3164 KB | Output is correct |
5 | Correct | 14 ms | 2900 KB | Output is correct |
6 | Correct | 12 ms | 3540 KB | Output is correct |
7 | Correct | 10 ms | 2760 KB | Output is correct |
8 | Correct | 12 ms | 3616 KB | Output is correct |
9 | Correct | 15 ms | 2772 KB | Output is correct |
10 | Correct | 12 ms | 3136 KB | Output is correct |
11 | Correct | 11 ms | 2900 KB | Output is correct |
12 | Correct | 13 ms | 2904 KB | Output is correct |
13 | Correct | 10 ms | 2884 KB | Output is correct |
14 | Correct | 16 ms | 3156 KB | Output is correct |
15 | Correct | 11 ms | 3160 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Execution timed out | 4067 ms | 3648 KB | Time limit exceeded |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 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 | 1 ms | 212 KB | Output is correct |
6 | Correct | 2 ms | 312 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 3 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 3 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 3 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 3 ms | 212 KB | Output is correct |
19 | Correct | 2 ms | 312 KB | Output is correct |
20 | Correct | 5 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 308 KB | Output is correct |
22 | Correct | 11 ms | 3156 KB | Output is correct |
23 | Correct | 10 ms | 2900 KB | Output is correct |
24 | Correct | 11 ms | 3164 KB | Output is correct |
25 | Correct | 14 ms | 2900 KB | Output is correct |
26 | Correct | 12 ms | 3540 KB | Output is correct |
27 | Correct | 10 ms | 2760 KB | Output is correct |
28 | Correct | 12 ms | 3616 KB | Output is correct |
29 | Correct | 15 ms | 2772 KB | Output is correct |
30 | Correct | 12 ms | 3136 KB | Output is correct |
31 | Correct | 11 ms | 2900 KB | Output is correct |
32 | Correct | 13 ms | 2904 KB | Output is correct |
33 | Correct | 10 ms | 2884 KB | Output is correct |
34 | Correct | 16 ms | 3156 KB | Output is correct |
35 | Correct | 11 ms | 3160 KB | Output is correct |
36 | Correct | 484 ms | 3220 KB | Output is correct |
37 | Correct | 717 ms | 2980 KB | Output is correct |
38 | Correct | 871 ms | 2976 KB | Output is correct |
39 | Correct | 210 ms | 3156 KB | Output is correct |
40 | Correct | 918 ms | 2984 KB | Output is correct |
41 | Correct | 831 ms | 3612 KB | Output is correct |
42 | Correct | 983 ms | 3608 KB | Output is correct |
43 | Correct | 752 ms | 2852 KB | Output is correct |
44 | Correct | 926 ms | 2852 KB | Output is correct |
45 | Correct | 485 ms | 3208 KB | Output is correct |
46 | Correct | 674 ms | 3216 KB | Output is correct |
47 | Correct | 931 ms | 2920 KB | Output is correct |
48 | Correct | 311 ms | 2892 KB | Output is correct |
49 | Correct | 997 ms | 2900 KB | Output is correct |
50 | Correct | 519 ms | 3244 KB | Output is correct |
51 | Correct | 1606 ms | 3248 KB | Output is correct |
52 | Correct | 1886 ms | 3244 KB | Output is correct |
53 | Correct | 0 ms | 304 KB | Output is correct |
54 | Execution timed out | 4051 ms | 3388 KB | Time limit exceeded |
55 | Halted | 0 ms | 0 KB | - |