Submission #13307

# Submission time Handle Problem Language Result Execution time Memory
13307 2015-02-11T15:52:51 Z woqja125 Collider (IZhO11_collider) C++
30 / 100
58 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+1000 && 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]; 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;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 9888 KB Output is correct
2 Correct 22 ms 9888 KB Output is correct
3 Incorrect 14 ms 9888 KB Output isn't correct
4 Incorrect 21 ms 9888 KB Output isn't correct
5 Incorrect 35 ms 9888 KB Output isn't correct
6 Incorrect 41 ms 9888 KB Output isn't correct
7 Correct 44 ms 9888 KB Output is correct
8 Incorrect 28 ms 9888 KB Output isn't correct
9 Incorrect 58 ms 9888 KB Output isn't correct
10 Incorrect 32 ms 9888 KB Output isn't correct