Submission #919622

#TimeUsernameProblemLanguageResultExecution timeMemory
919622tolbiDeda (COCI17_deda)C++17
140 / 140
75 ms8972 KiB
#pragma optimize("Bismillahirrahmanirrahim") //█▀█─█──█──█▀█─█─█ //█▄█─█──█──█▄█─█■█ //█─█─█▄─█▄─█─█─█─█ //Allahuekber //ahmet23 orz... //Sani buyuk Osman Pasa Plevneden cikmam diyor. //FatihSultanMehmedHan //YavuzSultanSelimHan //AbdulhamidHan #define author tolbi #include <bits/stdc++.h> using namespace std; template<typename X, typename Y> istream& operator>>(istream& in, pair<X,Y> &pr) {return in>>pr.first>>pr.second;} template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr) {return os<<pr.first<<" "<<pr.second;} template<typename X> istream& operator>>(istream& in, vector<X> &arr) {for(auto &it : arr) in>>it; return in;} template<typename X> ostream& operator<<(ostream& os, vector<X> arr) {for(auto &it : arr) os<<it<<" "; return os;} template<typename X, size_t Y> istream& operator>>(istream& in, array<X,Y> &arr) {for(auto &it : arr) in>>it; return in;} template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> arr) {for(auto &it : arr) os<<it<<" "; return os;} #define int long long #define endl '\n' #define vint(x) vector<int> x #define deci(x) int x;cin>>x; #define decstr(x) string x;cin>>x; #define cinarr(x) for (auto &it : x) cin>>it; #define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl; #define sortarr(x) sort(x.begin(),x.end()) #define sortrarr(x) sort(x.rbegin(),x.rend()) #define det(x) cout<<"NO\0YES"+x*3<<endl; #define INF LONG_LONG_MAX #define rev(x) reverse(x.begin(),x.end()); #define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define tol(bi) (1LL<<((int)(bi))) const int MOD = 1e9+7; mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count()); struct SegTree{ vector<int> segtree; SegTree(int n){ segtree.resize(tol(ceil(log2(n)+1))-1,INF); } void update(int node, int val){ node+=segtree.size()/2; segtree[node]=val; while (node){ node=(node-1)/2; segtree[node]=min(segtree[node*2+1],segtree[node*2+2]); } } int query(int x, int val, int l = 0, int r = -1, int node = 0){ if (r==-1) r = segtree.size()/2; if (l==r) return (segtree[node]<=val)?l+1:-1; int mid = l+(r-l)/2; if (segtree[node*2+1]>val){ return query(x, val, mid+1, r, node*2+2); } else if (x>=mid+1){ return query(x, val, mid+1, r, node*2+2); } int hh = query(x, val, l, mid, node*2+1); if (hh==-1) return query(x, val, mid+1, r, node*2+2); return hh; } }; int32_t main(){ ios; int t=1; int tno = 0; if (!t) cin>>t; while (t-(tno++)){ deci(n);deci(q); SegTree segtree(n); while (q--){ char chr; cin>>chr; deci(a);deci(x); if (chr=='M'){ segtree.update(x-1,a); } else { cout<<segtree.query(x-1,a)<<endl; } } } }//tleyi izleyin

Compilation message (stderr)

deda.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...