Submission #472872

# Submission time Handle Problem Language Result Execution time Memory
472872 2021-09-14T12:32:10 Z MamdouhN Lozinke (COCI17_lozinke) C++17
0 / 100
1 ms 956 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"

int ar [200005],seg[800005];
int uwu = 92716301829;
void update(int idx,int st,int en,int i,int value)
{
    if(en<i||st>i)return;
    if(st==en)
    {
        seg[idx] = ar[i] = value;
        return;
    }
    int mid = (st+en)/2;
    update(idx*2,st,mid,i,value);
    update(idx*2+1,mid+1,en,i,value);
    seg[idx]=min(seg[idx*2],seg[idx*2+1]);
}

int query(int idx,int st,int en,int qs,int qe,int y)
{
    if(en<qs||st>qe)return uwu;
    if(seg[idx]>y)return uwu;
    if(st==en)return st;
    int mid = (st+en)/2;
    int left  = query(idx*2,st,mid,qs,qe,y);
    int right = query(idx*2+1,mid+1,en,qs,qe,y);
    return min(left,right);
}

main()
{
    int n,q;
    cin>>n>>q;
    for(int i=0;i<4*n;i++)seg[i] = uwu;
    while(q--)
    {
        char c;
        int a,b;
        cin>>c>>a>>b;
        if(c=='M')
        {
            update(1,0,n,b,a);
        }
        else
        {
            int ans = query(1,0,n,b,n,a);
            cout<<(ans==uwu ? -1:ans)<<endl;
        }
    }
}

Compilation message

lozinke.cpp:33:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   33 | main()
      | ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Incorrect 1 ms 332 KB Output isn't correct
7 Incorrect 0 ms 332 KB Output isn't correct
8 Incorrect 0 ms 312 KB Output isn't correct
9 Incorrect 1 ms 588 KB Output isn't correct
10 Incorrect 1 ms 588 KB Output isn't correct
11 Incorrect 1 ms 692 KB Output isn't correct
12 Incorrect 1 ms 716 KB Output isn't correct
13 Incorrect 1 ms 844 KB Output isn't correct
14 Incorrect 1 ms 844 KB Output isn't correct
15 Incorrect 1 ms 844 KB Output isn't correct
16 Incorrect 1 ms 844 KB Output isn't correct
17 Incorrect 1 ms 844 KB Output isn't correct
18 Incorrect 1 ms 844 KB Output isn't correct
19 Incorrect 1 ms 956 KB Output isn't correct
20 Incorrect 1 ms 844 KB Output isn't correct