/** @BY_KUTBILIM **/
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define ll long long
int main(){
ios_base::sync_with_stdio(false);
cin.tie();
int n, q;
cin >> n >> q;
vector<char> v;
for(int i = 0; i < n; i++){
char c;
cin >> c;
v.pb(c);
}
while(q--){
char type;
cin >> type;
if(type == 'a'){
int i, j;
cin >> i >> j;
i--; j--;
char c = v[i];
v.erase(v.begin() + i, v.begin() + i + 1);
v.insert(v.begin() + j, c);
} else{
int i;
cin >> i;
cout << v[i] << endl;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |