Submission #686341

#TimeUsernameProblemLanguageResultExecution timeMemory
686341Ronin13Collider (IZhO11_collider)C++14
100 / 100
250 ms19448 KiB
#include <bits/stdc++.h>
#include <ext/rope>
#define ll long long
#define ull unsigned ll
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define epb emplace_back
using namespace std;
using namespace __gnu_cxx;
const int nmax = 5e5 + 1;



int main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
    crope r = "";
    int n; cin >> n;
    int m; cin >> m;
    for(int i = 1; i <= n; ++i){
        char x; cin >> x;
        r.pb(x);
    }
    for(int i = 1; i <= m; i++){
        char t; cin >> t;
        if(t == 'a'){
            int x, y; cin >> x >> y;
            char v = r[x - 1];
            r.erase(x - 1, 1);
            r.insert(y - 1, v);
        }
        else{
            int x; cin >> x;
            cout << r[x - 1] << "\n";
        }
    }
    return 0;
}

#Verdict Execution timeMemoryGrader output
Fetching results...