답안 #312387

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
312387 2020-10-13T05:59:04 Z Trickster 입자 가속기 (IZhO11_collider) C++11
0 / 100
2000 ms 2460 KB
//Just try and the idea will come
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	int n,m,l,r;
	cin>>n>>m>>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: In function 'int main()':
collider.cpp:12:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |    scanf("%d%d",&l,&r);
      |    ~~~~~^~~~~~~~~~~~~~
collider.cpp:21:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |    scanf("%d", &l);
      |    ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 11 ms 512 KB Output is correct
3 Correct 111 ms 640 KB Output is correct
4 Correct 890 ms 2092 KB Output is correct
5 Correct 1707 ms 2352 KB Output is correct
6 Execution timed out 2091 ms 2460 KB Time limit exceeded
7 Halted 0 ms 0 KB -