답안 #747231

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
747231 2023-05-24T01:39:10 Z 1075508020060209tc Fire (JOI20_ho_t5) C++14
8 / 100
1000 ms 29852 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n;int Q;
int ar[200005];
int rmq[22][200005];

int chmx(int l,int r){
int lg=__lg(r-l+1);
return max(rmq[lg][l],rmq[lg][r-(1<<lg)+1]);
}


signed main()
{
    cin>>n>>Q;
    for(int i=1;i<=n;i++){
        cin>>ar[i];
        rmq[0][i]=ar[i];
    }
    for(int i=1;i<=21;i++){
        for(int j=1;j+(1<<i)-1<=n;j++){
            rmq[i][j]=max(rmq[i-1][j],rmq[i-1][j+(1<<(i-1))]);
        }
    }

    while(Q--){
        int t;int l;int r;
        cin>>t>>l>>r;
    //    l=max(1ll,r-t);
        int ans=0;
        for(int i=l;i<=r;i++){
            ans+=chmx(max(1ll,i-t),i);
        }

        cout<<ans<<endl;

    }



}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 312 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 308 KB Output is correct
25 Correct 1 ms 308 KB Output is correct
26 Correct 1 ms 308 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 1061 ms 27500 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 532 ms 29156 KB Output is correct
3 Correct 477 ms 28624 KB Output is correct
4 Correct 511 ms 29852 KB Output is correct
5 Correct 479 ms 29172 KB Output is correct
6 Correct 501 ms 29452 KB Output is correct
7 Correct 469 ms 29468 KB Output is correct
8 Correct 503 ms 28984 KB Output is correct
9 Correct 504 ms 28736 KB Output is correct
10 Correct 540 ms 28444 KB Output is correct
11 Correct 485 ms 29776 KB Output is correct
12 Correct 469 ms 29644 KB Output is correct
13 Correct 496 ms 29572 KB Output is correct
14 Correct 477 ms 28820 KB Output is correct
15 Correct 483 ms 29764 KB Output is correct
16 Correct 481 ms 29668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1066 ms 27080 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 312 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 308 KB Output is correct
25 Correct 1 ms 308 KB Output is correct
26 Correct 1 ms 308 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 308 KB Output is correct
33 Execution timed out 1061 ms 27500 KB Time limit exceeded
34 Halted 0 ms 0 KB -