Submission #596784

# Submission time Handle Problem Language Result Execution time Memory
596784 2022-07-15T04:48:37 Z 반딧불(#8447) Fish 2 (JOI22_fish2) C++17
5 / 100
4000 ms 1976 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, q;
ll arr[100002];

int main(){
    scanf("%d", &n);
    for(int i=1; i<=n; i++) scanf("%lld", &arr[i]);
    scanf("%d", &q);
    while(q--){
        int t, l, r;
        scanf("%d %d %d", &t, &l, &r);
        if(t==1){
            arr[l] = r;
            continue;
        }
        int ans = 0;
        for(int i=l; i<=r; i++){
            int s = i, e = i;
            ll score = arr[i];
            while(1){
                if(l<s && score >= arr[s-1]) score += arr[--s];
                else if(e<r && score >= arr[e+1]) score += arr[++e];
                else break;
            }
            if(s==l && e==r) ans++;
        }
        printf("%d\n", ans);
    }
}

Compilation message

fish2.cpp: In function 'int main()':
fish2.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
fish2.cpp:12:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     for(int i=1; i<=n; i++) scanf("%lld", &arr[i]);
      |                             ~~~~~^~~~~~~~~~~~~~~~~
fish2.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
fish2.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d %d %d", &t, &l, &r);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 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 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 4 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Correct 4 ms 324 KB Output is correct
11 Correct 11 ms 212 KB Output is correct
12 Correct 2 ms 316 KB Output is correct
13 Correct 3 ms 312 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 4 ms 316 KB Output is correct
16 Correct 7 ms 212 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 3 ms 212 KB Output is correct
19 Correct 4 ms 212 KB Output is correct
20 Correct 24 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 477 ms 1064 KB Output is correct
3 Correct 73 ms 1364 KB Output is correct
4 Correct 459 ms 1644 KB Output is correct
5 Correct 64 ms 1400 KB Output is correct
6 Execution timed out 4050 ms 1976 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 4 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Correct 4 ms 324 KB Output is correct
11 Correct 11 ms 212 KB Output is correct
12 Correct 2 ms 316 KB Output is correct
13 Correct 3 ms 312 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 4 ms 316 KB Output is correct
16 Correct 7 ms 212 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 3 ms 212 KB Output is correct
19 Correct 4 ms 212 KB Output is correct
20 Correct 24 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 477 ms 1064 KB Output is correct
23 Correct 73 ms 1364 KB Output is correct
24 Correct 459 ms 1644 KB Output is correct
25 Correct 64 ms 1400 KB Output is correct
26 Execution timed out 4050 ms 1976 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 477 ms 1064 KB Output is correct
3 Correct 73 ms 1364 KB Output is correct
4 Correct 459 ms 1644 KB Output is correct
5 Correct 64 ms 1400 KB Output is correct
6 Execution timed out 4050 ms 1976 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 477 ms 1064 KB Output is correct
3 Correct 73 ms 1364 KB Output is correct
4 Correct 459 ms 1644 KB Output is correct
5 Correct 64 ms 1400 KB Output is correct
6 Execution timed out 4050 ms 1976 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 4 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Correct 4 ms 324 KB Output is correct
11 Correct 11 ms 212 KB Output is correct
12 Correct 2 ms 316 KB Output is correct
13 Correct 3 ms 312 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 4 ms 316 KB Output is correct
16 Correct 7 ms 212 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 3 ms 212 KB Output is correct
19 Correct 4 ms 212 KB Output is correct
20 Correct 24 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 477 ms 1064 KB Output is correct
23 Correct 73 ms 1364 KB Output is correct
24 Correct 459 ms 1644 KB Output is correct
25 Correct 64 ms 1400 KB Output is correct
26 Execution timed out 4050 ms 1976 KB Time limit exceeded
27 Halted 0 ms 0 KB -