Submission #1075502

#TimeUsernameProblemLanguageResultExecution timeMemory
1075502coolboy19521Collider (IZhO11_collider)C++17
100 / 100
177 ms19540 KiB
#include "bits/stdc++.h"
#include "ext/rope"
#define ll long long

using namespace std;
using namespace __gnu_cxx;

int main() {
    int n, m;
    cin >> n >> m;

    rope<char> rp;

    for (int i = 0; i < n; i ++) {
        char c; cin >> c;
        rp.push_back(c);
    }

    while (m --) {
        char c; cin >> c;
        if ('a' == c) {
            int a, b; cin >> a >> b;
            a --, b --;
            char c = rp[a];
            rp.erase(rp.mutable_begin() + a);
            rp.insert(rp.mutable_begin() + b, c);
        } else {
            int x; cin >> x;
            x --;
            cout << rp[x] << '\n';
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...