답안 #867402

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
867402 2023-10-28T10:36:05 Z hentai_lover 입자 가속기 (IZhO11_collider) C++14
0 / 100
1 ms 344 KB
///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

collider.cpp: In function 'int main()':
collider.cpp:48:9: warning: unused variable 'T' [-Wunused-variable]
   48 |     int T;
      |         ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -