Submission #1115055

# Submission time Handle Problem Language Result Execution time Memory
1115055 2024-11-19T23:17:45 Z staszic_ojuz Fire (JOI20_ho_t5) C++17
Compilation error
0 ms 0 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)<<"
";
    }
}

Compilation message

ho_t5.cpp:48:34: warning: missing terminating " character
   48 |         cout<<spr(max(0,l-t),r)<<"
      |                                  ^
ho_t5.cpp:48:34: error: missing terminating " character
ho_t5.cpp:49:1: warning: missing terminating " character
   49 | ";
      | ^
ho_t5.cpp:49:1: error: missing terminating " character
   49 | ";
      | ^~
ho_t5.cpp: In function 'int main()':
ho_t5.cpp:50:5: error: expected primary-expression before '}' token
   50 |     }
      |     ^