답안 #334158

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
334158 2020-12-08T13:37:23 Z apostoldaniel854 입자 가속기 (IZhO11_collider) C++14
100 / 100
897 ms 2696 KB
#include <bits/stdc++.h>

using namespace std;

int main () {
    ios::sync_with_stdio (false);
    cin.tie (0); cout.tie (0);
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    while (q--) {
        char op;
        cin >> op;
        if (op == 'a') {
            int x, y;
            cin >> x >> y;
            x--, y--;
            string to_add (1, s[x]);
            s.erase (x, 1);
            s.insert (y, to_add);
        }
        else {
            int x;
            cin >> x; x--;
            cout << s[x] << "\n";
        }
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 3 ms 492 KB Output is correct
3 Correct 17 ms 748 KB Output is correct
4 Correct 240 ms 2176 KB Output is correct
5 Correct 443 ms 2184 KB Output is correct
6 Correct 648 ms 2440 KB Output is correct
7 Correct 716 ms 2568 KB Output is correct
8 Correct 308 ms 2440 KB Output is correct
9 Correct 897 ms 2696 KB Output is correct
10 Correct 603 ms 2624 KB Output is correct