Submission #1114988

# Submission time Handle Problem Language Result Execution time Memory
1114988 2024-11-19T21:28:22 Z AdamGS Fire (JOI20_ho_t5) C++17
7 / 100
104 ms 5704 KB
#include <bits/stdc++.h>
using namespace std;
int tr[400000];
int n,q;
void add(int p,int w)
{
    p+=n;
    tr[p] = w;
    p/=2;
    while(p > 0)
    {
        tr[p] = max(tr[p*2],tr[p*2+1]);
        p/=2;
    }
}
int spr(int l,int r)
{
    l+=n;r+=n;
    int ans = 0;
    ans = max(ans, tr[l]);
    ans = max(ans, tr[r]);
    while(l/2 != r/2)
    {
        if(l%2 == 0) ans = max(ans,tr[l+1]);
        if(r%2 == 1) ans = max(ans,tr[r-1]);
        l/=2;r/=2;
    }
    return ans;

}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>q;
    for(int i = 0;i<n;i++)
    {
        int x;
        cin>>x;
        add(i,x);
    }
    for(int i = 0;i<q;i++)
    {
        int t,l,r;
        cin>>t>>l>>r;
        l--;r--;
        cout<<spr(max(0,l-t),r)<<"\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 92 ms 5124 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 102 ms 5480 KB Output is correct
3 Correct 88 ms 3660 KB Output is correct
4 Correct 91 ms 3912 KB Output is correct
5 Correct 104 ms 3656 KB Output is correct
6 Correct 94 ms 3924 KB Output is correct
7 Correct 95 ms 3912 KB Output is correct
8 Correct 98 ms 3920 KB Output is correct
9 Correct 96 ms 3912 KB Output is correct
10 Correct 89 ms 3656 KB Output is correct
11 Correct 100 ms 3864 KB Output is correct
12 Correct 94 ms 3884 KB Output is correct
13 Correct 98 ms 3912 KB Output is correct
14 Correct 93 ms 3912 KB Output is correct
15 Correct 104 ms 3912 KB Output is correct
16 Correct 101 ms 5704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 85 ms 3144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -