답안 #745577

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
745577 2023-05-20T12:16:57 Z Pacybwoah Fire (JOI20_ho_t5) C++14
8 / 100
1000 ms 11756 KB
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#define ll long long
using namespace std;
vector<ll> seg;
vector<ll> vec;
void build(int l,int r,int ind){
    if(l==r){
        seg[ind]=vec[l];
        return;
    }
    int mid=(l+r)>>1;
    build(l,mid,ind*2);
    build(mid+1,r,ind*2+1);
    seg[ind]=max(seg[ind*2],seg[ind*2+1]);
}
ll query(int l,int r,int start,int end,int ind){
    if(r<start||end<l) return 0;
    if(start<=l&&r<=end) return seg[ind];
    int mid=(l+r)>>1;
    return max(query(l,mid,start,end,ind*2),query(mid+1,r,start,end,ind*2+1));
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,q;
    cin>>n>>q;
    vector<ll> f(n+1);
    seg.resize(4*n+4);
    for(int i=0;i<n;i++) cin>>f[i+1];
    vec.resize(n+1);
    for(int i=1;i<=n;i++) vec[i]=f[i];
    build(1,n,1);
    int a,b,c;
    for(int i=0;i<q;i++){
        cin>>a>>b>>c;
        ll ans=0;
        for(int j=b;j<=c;j++){
            ans+=query(1,n,max(1,j-a),j,1);
        }
        cout<<ans<<"\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 320 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 2 ms 324 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 324 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 2 ms 212 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 2 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 2 ms 324 KB Output is correct
32 Correct 2 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 1075 ms 9480 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 133 ms 11340 KB Output is correct
3 Correct 130 ms 11140 KB Output is correct
4 Correct 135 ms 11596 KB Output is correct
5 Correct 133 ms 11300 KB Output is correct
6 Correct 151 ms 11424 KB Output is correct
7 Correct 126 ms 11488 KB Output is correct
8 Correct 130 ms 11388 KB Output is correct
9 Correct 147 ms 11224 KB Output is correct
10 Correct 132 ms 11164 KB Output is correct
11 Correct 142 ms 11756 KB Output is correct
12 Correct 131 ms 11488 KB Output is correct
13 Correct 138 ms 11456 KB Output is correct
14 Correct 146 ms 11240 KB Output is correct
15 Correct 136 ms 11536 KB Output is correct
16 Correct 141 ms 11492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1073 ms 9276 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 212 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 320 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 2 ms 324 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 324 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 2 ms 212 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 2 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 2 ms 324 KB Output is correct
32 Correct 2 ms 212 KB Output is correct
33 Execution timed out 1075 ms 9480 KB Time limit exceeded
34 Halted 0 ms 0 KB -