# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1123 |
2013-06-26T06:54:14 Z |
jiws829 |
백신 (KOI13_vaccine) |
C++ |
|
333 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");
}
# |
Verdict |
Execution time |
Memory |
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 |
# |
Verdict |
Execution time |
Memory |
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 |
# |
Verdict |
Execution time |
Memory |
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 |
# |
Verdict |
Execution time |
Memory |
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 |
3 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1280 KB |
Output is correct |
2 |
Correct |
3 ms |
1280 KB |
Output is correct |
3 |
Correct |
3 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 |
2 ms |
1280 KB |
Output is correct |
7 |
Correct |
3 ms |
1280 KB |
Output is correct |
8 |
Correct |
9 ms |
1280 KB |
Output is correct |
9 |
Correct |
13 ms |
1280 KB |
Output is correct |
10 |
Correct |
114 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
25 ms |
1280 KB |
Output is correct |
8 |
Correct |
12 ms |
1280 KB |
Output is correct |
9 |
Correct |
333 ms |
1280 KB |
Output is correct |
10 |
Correct |
314 ms |
1280 KB |
Output is correct |