(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 #954254

#TimeUsernameProblemLanguageResultExecution timeMemory
954254vjudge1Deda (COCI17_deda)C++17
80 / 140
1061 ms7836 KiB
#include <bits/stdc++.h> using namespace std; #define ishowspeed ios::sync_with_stdio(0),cin.tie(0); #define int long long #define MXN 200055 #define cl(x) (x<<1) #define cr(x) (x<<1)+1 int seg[MXN*4+5],arr[MXN]; int searchb = 1e18; int ansl = 1e18; int query(int id,int l,int r,int sl,int sr){ if(sl<=l&&r<=sr) { if(seg[id] > searchb) return seg[id]; else{ if(l == r) { ansl = min(ansl,l); return seg[id]; } } } int mid=(l+r)>>1,res=1e18; if(sl<=mid){ int x = query(cl(id),l,mid,sl,sr); res = min(res,x); } if(mid<sr){ int x = query(cr(id),mid+1,r,sl,sr); res = min(res,x); } return res; } void pull(int id){ seg[id] = min(seg[cl(id)] , seg[cr(id)]); } void update(int id,int l,int r,int x,int v){ if(l==r){ seg[id] = v; return; } int mid=(l+r)>>1; if(x<=mid){ update(cl(id),l,mid,x,v); } if(mid<x){ update(cr(id),mid+1,r,x,v); } pull(id); } void build(int id,int l,int r){ if(l==r){ seg[id]=arr[l]; return; } int mid=(l+r)>>1; build(cl(id),l,mid); build(cr(id),mid+1,r); pull(id); } signed main(){ ishowspeed int n,q,x,L,R; cin >> n >> q; L = 1; R = n; for(int i = 1;i <= n;i++) arr[i] = 1e18; build(1,L,R); char o; int a,b; while(q--){ cin >> o >> a >> b; if(o == 'M') update(1,L,R,b,a); else { searchb = a; ansl = 1e18; int rs = query(1,1,R,b,R); if(rs <= searchb) cout << ansl << '\n'; else cout << "-1\n"; } } }

Compilation message (stderr)

deda.cpp: In function 'int main()':
deda.cpp:61:13: warning: unused variable 'x' [-Wunused-variable]
   61 |     int n,q,x,L,R;
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...