# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
336958 | kutbilim_one | Collider (IZhO11_collider) | C++14 | 1 ms | 364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/** @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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |