답안 #745575

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
745575 2023-05-20T12:11:58 Z Pacybwoah Fire (JOI20_ho_t5) C++14
7 / 100
171 ms 17340 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;
        cout<<query(1,n,max(1,b-a),c,1)<<"\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 132 ms 17024 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 145 ms 17004 KB Output is correct
3 Correct 140 ms 16744 KB Output is correct
4 Correct 153 ms 17340 KB Output is correct
5 Correct 132 ms 16840 KB Output is correct
6 Correct 150 ms 16980 KB Output is correct
7 Correct 149 ms 16964 KB Output is correct
8 Correct 143 ms 16980 KB Output is correct
9 Correct 134 ms 16844 KB Output is correct
10 Correct 136 ms 16572 KB Output is correct
11 Correct 171 ms 17212 KB Output is correct
12 Correct 128 ms 16992 KB Output is correct
13 Correct 144 ms 17112 KB Output is correct
14 Correct 132 ms 16824 KB Output is correct
15 Correct 145 ms 17204 KB Output is correct
16 Correct 133 ms 17028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 131 ms 13724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -