Submission #336960

#TimeUsernameProblemLanguageResultExecution timeMemory
336960kutbilim_oneCollider (IZhO11_collider)C++14
0 / 100
2096 ms8112 KiB
/** @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--;
			if(y < x){
				s = s.substr(0, y) + s[x] + s.substr(y, x-y) + s.substr(x+1);
			}else{
				s = s.substr(0, x) + s.substr(x+1, y-x) + s[x] + s.substr(y+1);
			}
		}else cout << s[x] << endl;
	}


	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...