# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
867402 | hentai_lover | Collider (IZhO11_collider) | C++14 | 1 ms | 344 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
///for JN
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
void solve(){
tree<pair<int, pair<int, char> >, null_type,less<pair<int, pair<int, char> >>, rb_tree_tag,tree_order_statistics_node_update> st;
int n, q;
cin>>n>>q;
int id = 100000000;
for(int i = 0; i < n; i += 1){
char c;
cin>>c;
st.insert({i, {-- id, c}});
}
while(q --){
char c;
cin>>c;
if(c == 'q'){
int x;
cin>>x;
x -= 1;
auto it = st.find_by_order(x);
cout<<(*it).second.second<<"\n";
} else {
int x, y;
cin>>x>>y;
x -= 1;
y -= 1;
auto it = st.find_by_order(x);
pair<int, pair<int, char> > tmp = *it;
tmp.second.first -= 1;
tmp.first = y;
st.erase(it);
st.insert(tmp);
}
}
}
int main() {
int T;
//cin>>T;
solve();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |