Submission #168537

# Submission time Handle Problem Language Result Execution time Memory
168537 2019-12-13T14:53:47 Z abil Collider (IZhO11_collider) C++14
100 / 100
707 ms 3504 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'){
			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

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 time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 13 ms 504 KB Output is correct
3 Correct 28 ms 632 KB Output is correct
4 Correct 223 ms 2096 KB Output is correct
5 Correct 392 ms 2320 KB Output is correct
6 Correct 522 ms 2472 KB Output is correct
7 Correct 583 ms 3500 KB Output is correct
8 Correct 274 ms 3504 KB Output is correct
9 Correct 707 ms 3504 KB Output is correct
10 Correct 503 ms 3500 KB Output is correct