/** @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;
for(int i = 0, x, y; i < m; i++){
char oper;
cin >> oper >> x;
x--;
if(oper == 'a'){
cin >> y;
y--;
char temp = s[x];
s.erase(s.begin()+x);
s.insert(s.begin()+y, temp);
}else cout << s[x] << endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
3 ms |
364 KB |
Output is correct |
3 |
Correct |
17 ms |
492 KB |
Output is correct |
4 |
Correct |
214 ms |
1416 KB |
Output is correct |
5 |
Correct |
417 ms |
1408 KB |
Output is correct |
6 |
Correct |
608 ms |
1408 KB |
Output is correct |
7 |
Correct |
681 ms |
2312 KB |
Output is correct |
8 |
Correct |
285 ms |
2440 KB |
Output is correct |
9 |
Correct |
867 ms |
2312 KB |
Output is correct |
10 |
Correct |
563 ms |
2312 KB |
Output is correct |