# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
867402 | hentai_lover | 입자 가속기 (IZhO11_collider) | C++14 | 1 ms | 344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
///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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |