답안 #1122

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1122 2013-06-26T06:46:12 Z jiws829 백신 (KOI13_vaccine) C++
24 / 24
329 ms 1280 KB
#include<stdio.h>
int n,m;
int num[101];
int p[101][1001];
int check(int a,int b)
{
	int i,j,k;
	int r;
	
	for(i=3;i<=n;i++)
	{
		r=0;
		for(j=1;j<=num[i];j++)
		{
			if(p[1][a]==p[i][j])
			{
				for(k=0;;k++)
				{
					if(p[1][a+k]!=p[i][j+k] || a+k>num[1] || j+k>num[i]) break;
				}
				if(k>m) {r=1;break;}
				
				for(k=0;;k++)
				{
					if(p[1][a+k]!=p[i][j-k] || a+k>num[1] || j-k<1) break;
				}
				if(k>m) {r=1;break;}
			}
		}
		if(r==0) return 0;
	}
	return 1;
}
int main()
{
	scanf("%d %d",&n,&m);
	
	int i,j,k,r;
	
	for(i=1;i<=n;i++)
	{
		scanf("%d",&num[i]);
		for(j=1;j<=num[i];j++)
		{
			scanf("%d",&p[i][j]);
		}
	}
	
	for(i=1;i<=num[1];i++)
	{
		for(j=1;j<=num[2];j++)
		{
			if(p[1][i]==p[2][j])
			{
				for(k=0;;k++)
				{
					if(p[1][i+k]!=p[2][j+k] || i+k>num[1] || j+k>num[2]) break;
				}
				if(k>=m)
				{
					r=check(i,k);
					if(r) break;
				}
				
				for(k=0;;k++)
				{
					if(p[1][i+k]!=p[2][j-k] || i+k>num[1] || j-k<1) break;
				}
				if(k>=m)
				{
					r=check(i,k);
					if(r) break;
				}
			}
		}
		if(r) break;
	}
	if(r) printf("YES");
	else printf("NO");
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1280 KB Output is correct
2 Correct 0 ms 1280 KB Output is correct
3 Correct 0 ms 1280 KB Output is correct
4 Correct 0 ms 1280 KB Output is correct
5 Correct 0 ms 1280 KB Output is correct
6 Correct 0 ms 1280 KB Output is correct
7 Correct 0 ms 1280 KB Output is correct
8 Correct 0 ms 1280 KB Output is correct
9 Correct 0 ms 1280 KB Output is correct
10 Correct 0 ms 1280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1280 KB Output is correct
2 Correct 0 ms 1280 KB Output is correct
3 Correct 0 ms 1280 KB Output is correct
4 Correct 0 ms 1280 KB Output is correct
5 Correct 0 ms 1280 KB Output is correct
6 Correct 0 ms 1280 KB Output is correct
7 Correct 0 ms 1280 KB Output is correct
8 Correct 0 ms 1280 KB Output is correct
9 Correct 0 ms 1280 KB Output is correct
10 Correct 0 ms 1280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1280 KB Output is correct
2 Correct 0 ms 1280 KB Output is correct
3 Correct 0 ms 1280 KB Output is correct
4 Correct 0 ms 1280 KB Output is correct
5 Correct 0 ms 1280 KB Output is correct
6 Correct 0 ms 1280 KB Output is correct
7 Correct 0 ms 1280 KB Output is correct
8 Correct 0 ms 1280 KB Output is correct
9 Correct 0 ms 1280 KB Output is correct
10 Correct 1 ms 1280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1280 KB Output is correct
2 Correct 0 ms 1280 KB Output is correct
3 Correct 0 ms 1280 KB Output is correct
4 Correct 0 ms 1280 KB Output is correct
5 Correct 0 ms 1280 KB Output is correct
6 Correct 0 ms 1280 KB Output is correct
7 Correct 0 ms 1280 KB Output is correct
8 Correct 0 ms 1280 KB Output is correct
9 Correct 3 ms 1280 KB Output is correct
10 Correct 2 ms 1280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1280 KB Output is correct
2 Correct 3 ms 1280 KB Output is correct
3 Correct 4 ms 1280 KB Output is correct
4 Correct 27 ms 1280 KB Output is correct
5 Correct 2 ms 1280 KB Output is correct
6 Correct 3 ms 1280 KB Output is correct
7 Correct 3 ms 1280 KB Output is correct
8 Correct 7 ms 1280 KB Output is correct
9 Correct 14 ms 1280 KB Output is correct
10 Correct 114 ms 1280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1280 KB Output is correct
2 Correct 10 ms 1280 KB Output is correct
3 Correct 12 ms 1280 KB Output is correct
4 Correct 7 ms 1280 KB Output is correct
5 Correct 11 ms 1280 KB Output is correct
6 Correct 15 ms 1280 KB Output is correct
7 Correct 26 ms 1280 KB Output is correct
8 Correct 12 ms 1280 KB Output is correct
9 Correct 329 ms 1280 KB Output is correct
10 Correct 315 ms 1280 KB Output is correct