제출 #167512

#제출 시각아이디문제언어결과실행 시간메모리
167512Toirov_Sadi입자 가속기 (IZhO11_collider)C++17
100 / 100
653 ms2712 KiB
#include <bits/stdc++.h>

#define fr first
#define se second

using namespace std;

const long long N = 1e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int n;
int m;
int l;
int r;
char x;
string s;
int main()
{
    /// freopen("input.txt", "r", stdin);
    /// freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio( false );

    cin >> n >> m >> s;
    for(int i = 1; i <= m; i ++){
        cin >> x;
        if(x == 'a'){
            cin >> l >> r;
            l --, r --;
            string y = "";
            y += s[l];
            s.erase(l, 1);
            s.insert(r, y);
        }
        else{
            cin >> l;
            cout << s[l - 1] << "\n";
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...