답안 #790931

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
790931 2023-07-23T09:30:28 Z eltu0815 Fish 2 (JOI22_fish2) C++14
5 / 100
4000 ms 1632 KB
#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 {
            int cnt = 0;
            for(int i = a; i <= b; ++i) {
                ll sz = arr[i];
                int 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;
}
# 결과 실행 시간 메모리 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 0 ms 212 KB Output is correct
5 Correct 3 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 336 KB Output is correct
9 Correct 11 ms 212 KB Output is correct
10 Correct 5 ms 340 KB Output is correct
11 Correct 19 ms 336 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 3 ms 328 KB Output is correct
14 Correct 2 ms 336 KB Output is correct
15 Correct 2 ms 212 KB Output is correct
16 Correct 9 ms 332 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 3 ms 340 KB Output is correct
19 Correct 4 ms 288 KB Output is correct
20 Correct 27 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 562 ms 700 KB Output is correct
3 Correct 57 ms 1032 KB Output is correct
4 Correct 591 ms 1276 KB Output is correct
5 Correct 68 ms 980 KB Output is correct
6 Execution timed out 4053 ms 1632 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 ms 212 KB Output is correct
5 Correct 3 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 336 KB Output is correct
9 Correct 11 ms 212 KB Output is correct
10 Correct 5 ms 340 KB Output is correct
11 Correct 19 ms 336 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 3 ms 328 KB Output is correct
14 Correct 2 ms 336 KB Output is correct
15 Correct 2 ms 212 KB Output is correct
16 Correct 9 ms 332 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 3 ms 340 KB Output is correct
19 Correct 4 ms 288 KB Output is correct
20 Correct 27 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 562 ms 700 KB Output is correct
23 Correct 57 ms 1032 KB Output is correct
24 Correct 591 ms 1276 KB Output is correct
25 Correct 68 ms 980 KB Output is correct
26 Execution timed out 4053 ms 1632 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 562 ms 700 KB Output is correct
3 Correct 57 ms 1032 KB Output is correct
4 Correct 591 ms 1276 KB Output is correct
5 Correct 68 ms 980 KB Output is correct
6 Execution timed out 4053 ms 1632 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 562 ms 700 KB Output is correct
3 Correct 57 ms 1032 KB Output is correct
4 Correct 591 ms 1276 KB Output is correct
5 Correct 68 ms 980 KB Output is correct
6 Execution timed out 4053 ms 1632 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 ms 212 KB Output is correct
5 Correct 3 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 336 KB Output is correct
9 Correct 11 ms 212 KB Output is correct
10 Correct 5 ms 340 KB Output is correct
11 Correct 19 ms 336 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 3 ms 328 KB Output is correct
14 Correct 2 ms 336 KB Output is correct
15 Correct 2 ms 212 KB Output is correct
16 Correct 9 ms 332 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 3 ms 340 KB Output is correct
19 Correct 4 ms 288 KB Output is correct
20 Correct 27 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 562 ms 700 KB Output is correct
23 Correct 57 ms 1032 KB Output is correct
24 Correct 591 ms 1276 KB Output is correct
25 Correct 68 ms 980 KB Output is correct
26 Execution timed out 4053 ms 1632 KB Time limit exceeded
27 Halted 0 ms 0 KB -