/** @kutbilimone **/
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define all(x) x.begin(),x.end()
#define int long long
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
string s;
cin >> s;
s += " ";
for(int i = 0; i < m; i++){
char oper;
cin >> oper;
if(oper == 'a'){
int x, y;
cin >> x >> y;
if(x > y){
char temp = s[x-1];
s.erase(s.begin()+x-1);
s.insert(s.begin()+y-1, temp);
}else{
s.insert(s.begin()+y-1, s[x-1]);
s.erase(s.begin()+x-1);
}
}else{
int x;
cin >> x;
cout << s[x-1] << endl;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |