답안 #13311

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
13311 2015-02-11T16:07:06 Z woqja125 입자 가속기 (IZhO11_collider) C++
0 / 100
8 ms 9888 KB
#include<stdio.h>
#include<vector>
int buk[1001][2001];
int bs[1001];
char in[1000001];
int main()
{
	int n, m;
	int i, j, k;
	int a, b, bn;
	scanf("%d%d", &n, &m);
	scanf("%s", in);
	j=0;
	for(i=0; j<n; i++)
	{
		for(k=j; k<j+2 && k<n; k++)
		{
			buk[i][k-j] = in[k]-'x';
			bs[i]++;
		}
		j = k;
	}
	for(;m--;)
	{
		scanf("%s", in);
		if(in[0] == 'a')
		{
			scanf("%d%d", &a, &b); a--; b--;
			int t;
			bn = 0;
			j = 0;
			for(i=0; i<a; )
			{
				if(i+bs[bn] <= a) i+=bs[bn++];
				else{i++;j++;}
			}
			bs[bn]--;
			t = buk[bn][j];
			for(; j<bs[bn]; j++) buk[bn][j] = buk[bn][j+1];
			bn = 0;
			j = 0;
			for(i=0; i<b; )
			{
				if(i+bs[bn] <= b) i+=bs[bn++];
				else{i++;j++;}
			}
			bs[bn]++;
			for(k=bs[bn]-1; k>j; k--) buk[bn][k] = buk[bn][k-1];
			buk[bn][j] = t;
		}
		else
		{
			scanf("%d", &a);a--;

			bn = 0;
			j = 0;
			for(i=0; i<a; )
			{
				if(i+bs[bn] <= a) i+=bs[bn++];
				else{i++;j++;}
			}
			printf("%c\n", buk[bn][j]+'x');
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 9888 KB Output isn't correct
2 Incorrect 8 ms 9888 KB Output isn't correct
3 Runtime error 0 ms 9884 KB SIGSEGV Segmentation fault
4 Runtime error 0 ms 9884 KB SIGSEGV Segmentation fault
5 Runtime error 4 ms 9884 KB SIGSEGV Segmentation fault
6 Runtime error 0 ms 9884 KB SIGSEGV Segmentation fault
7 Runtime error 0 ms 9884 KB SIGSEGV Segmentation fault
8 Runtime error 4 ms 9884 KB SIGSEGV Segmentation fault
9 Runtime error 6 ms 9884 KB SIGSEGV Segmentation fault
10 Runtime error 0 ms 9884 KB SIGSEGV Segmentation fault