Submission #575415

# Submission time Handle Problem Language Result Execution time Memory
575415 2022-06-10T11:07:51 Z KoD Collider (IZhO11_collider) C++17
100 / 100
218 ms 19452 KB
#include <bits/extc++.h>

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n, q;
    std::cin >> n >> q;
    __gnu_cxx::rope<char> r;
    while (n--) {
        char c;
        std::cin >> c;
        r.push_back(c);
    }
    while (q--) {
        char c;
        std::cin >> c;
        if (c == 'a') {
            int x, y;
            std::cin >> x >> y;
            x -= 1, y -= 1;
            const char v = r[x];
            r.erase(x, 1);
            r.insert(y, v);
        } else {
            int k;
            std::cin >> k;
            k -= 1;
            std::cout << r[k] << '\n';
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 21 ms 468 KB Output is correct
3 Correct 30 ms 3404 KB Output is correct
4 Correct 98 ms 14820 KB Output is correct
5 Correct 130 ms 15868 KB Output is correct
6 Correct 170 ms 17480 KB Output is correct
7 Correct 192 ms 18668 KB Output is correct
8 Correct 102 ms 17748 KB Output is correct
9 Correct 218 ms 19452 KB Output is correct
10 Correct 147 ms 18512 KB Output is correct