(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #942346

#TimeUsernameProblemLanguageResultExecution timeMemory
942346vjudge1Deda (COCI17_deda)C++17
140 / 140
79 ms5776 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> using namespace std; #define int long long #define OYY 100000000000005 #define mod 1000000007 #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define FOR for(int i=1;i<=n;i++) #define mid (start+end)/2 #define lim 200005 #define fi first #define se second int tree[4*lim]; int ans; bool stop; inline void build(int node,int start,int end){ if(start>end)return ; if(start==end){ tree[node]=OYY; return ; } build(node*2,start,mid),build(node*2+1,mid+1,end); tree[node]=tree[node*2]; } inline void update(int node,int start,int end,int l,int r,int val){ if(start>end || start>r || end<l)return ; if(start>=l && end<=r){ tree[node]=val; return; } update(node*2,start,mid,l,r,val),update(node*2+1,mid+1,end,l,r,val); tree[node]=min(tree[node*2],tree[node*2+1]); } inline void query(int node,int start,int end ,int l,int r,int maxi){ if(start>end || start>r || end<l)return ; if(tree[node]>maxi)return ; if(stop)return ; if(start==end){ ans=start; stop=true; return; } query(node*2,start,mid,l,r,maxi),query(node*2+1,mid+1,end,l,r,maxi); } int32_t main(){ faster int n,q;cin>>n>>q; build(1,1,n); while(q--){ char c;int x,y;cin>>c>>x>>y; if(c=='M'){ update(1,1,n,y,y,x); } else{ ans=-1;stop=false; query(1,1,n,y,n,x); cout<<ans<<'\n'; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...