답안 #168537

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
168537 2019-12-13T14:53:47 Z abil 입자 가속기 (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);
    ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 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