Submission #168538

# Submission time Handle Problem Language Result Execution time Memory
168538 2019-12-13T14:54:34 Z abil Collider (IZhO11_collider) C++14
100 / 100
719 ms 2604 KB
#include <bits/stdc++.h>

#define fr first
#define sc second
#define pb push_bacak
#define mk make_pair
#define all(s) s.begin(),s.end()
//#define int long long

using namespace std;

const int N = (1e6 + 12);
const int mod = (1e9 + 7);
const int INF = (0x3f3f3f3f);

main()
{
	string s;
	int n, m, l, r;
	cin >> n >> m;
	cin >> s;
	char ch;
	while(m--){
		cin >> ch;
		if(ch == 'a'){
			cin >> l >> r;
			l--;
			r--;
			string c = "";
			c = (s[l]);
			s.erase(l, 1);
			s.insert(r,c);
		}
		else{
			cin >> l;
			l--;
			cout << s[l] << endl;
		}
	}
	
}

Compilation message

collider.cpp:16:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 17 ms 376 KB Output is correct
3 Correct 31 ms 860 KB Output is correct
4 Correct 239 ms 1528 KB Output is correct
5 Correct 395 ms 1556 KB Output is correct
6 Correct 541 ms 1556 KB Output is correct
7 Correct 602 ms 2480 KB Output is correct
8 Correct 287 ms 2476 KB Output is correct
9 Correct 719 ms 2476 KB Output is correct
10 Correct 512 ms 2604 KB Output is correct