Submission #168537

#TimeUsernameProblemLanguageResultExecution timeMemory
168537abilCollider (IZhO11_collider)C++14
100 / 100
707 ms3504 KiB
#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'){
			scanf("%d%d", &l, &r);
			l--;
			r--;
			string c = "";
			c = (s[l]);
			s.erase(l, 1);
			s.insert(r,c);
		}
		else{
			scanf("%d", &l);
			l--;
			printf("%c\n", s[l]);
		}
	}
	
}

Compilation message (stderr)

collider.cpp:16:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
collider.cpp: In function 'int main()':
collider.cpp:26:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d%d", &l, &r);
    ~~~~~^~~~~~~~~~~~~~~~
collider.cpp:35:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &l);
    ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...