Submission #445982

# Submission time Handle Problem Language Result Execution time Memory
445982 2021-07-20T10:32:23 Z nickmet2004 Deda (COCI17_deda) C++11
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n , q , a[N];
int T[1<<20] , S , A;
char B;
void upd(int id , int l = 0 , int r = n - 1 , int pos= 0){
    if(id < l || id > r) return;
    if(l == r){T[pos] = S; return;}
    int mid = (l + r) >>1;
    upd(id ,l , mid ,pos * 2 + 1); upd(id ,mid + 1 , r , pos * 2 + 2);
    T[pos] = min(T[pos * 2 + 1] ,T[pos * 2 + 2]);
}
int f(int L , int R , int l = 0 , int r = n - 1 , int pos = 0){
    if(R < l || r < L)return -2;
    if(L <= l && r <= R){
        if(T[pos] > S)return -2;
        while(l < r){
            int mid = (l + r) >>1;
            if(T[pos * 2 + 1] <= S) r= mid , pos = pos * 2 + 1;
            else pos = pos * 2 + 2 , l = mid+ 1;
        }return l;
    }
    int mid = (l + r) >> 1;
    int k = f(L , R , l , mid , pos * 2 + 1);
    if(k != -2)return k;
    return f(L , R , mid + 1 , r , pos * 2 + 2);
}
int main (){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> q;
    for(int i = 0; i < 4 * N; ++i) T[i] = 2e9;
    while(q--){
        cin >> B >> S >> A; --A;
        if(B == 'M') upd(A);
        else cout << f(A , n - 1)+1
    }
}

Compilation message

deda.cpp: In function 'int main()':
deda.cpp:36:36: error: expected ';' before '}' token
   36 |         else cout << f(A , n - 1)+1
      |                                    ^
      |                                    ;
   37 |     }
      |     ~