# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
3139 |
2013-08-26T07:43:29 Z |
club4208 |
백신 (KOI13_vaccine) |
C++ |
|
16 ms |
5548 KB |
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <vector>
int dt[101][1001], n, k;
int num[1001], hash1[10001], cn[10001];
int hash2[10001][101], chk[10001];
int main(){
scanf("%d %d", &n, &k);
int i, j, l, a, cnt1, cnt2, flg=0;
for(i=1;i<=n;i++){
scanf("%d", &num[i]);
for(j=1;j<=num[i];j++){
scanf("%d", &dt[i][j]);
a=dt[i][j];
if(hash2[a][i] == 0){ hash2[a][i]=1; cn[a]++; }
}
}
for(i=1;i<=10000;i++){
if(cn[i] == n) chk[i]=1;
}
for(i=1;i<=num[1]-k+1;i++){
for(j=1;j<=10000;j++) hash1[j]=0;
for(j=i;j<=i+k-1;j++){
if(!chk[dt[1][j]]) break;
hash1[dt[1][j]]=1;
}
if(!chk[dt[1][j]] && j!=i+k) continue;
cnt2=0;
for(j=2;j<=n;j++){
cnt1=0;
for(l=1;l<=num[j];l++){
if(hash1[dt[j][l]]==1) cnt1++;
else cnt1=0;
if(cnt1==k) break;
}
if(cnt1==k) cnt2++;
}
if(cnt2==n-1){
printf("YES");
flg=1;
break;
}
}
if(!flg) printf("NO");
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5548 KB |
Output is correct |
2 |
Correct |
0 ms |
5548 KB |
Output is correct |
3 |
Correct |
0 ms |
5548 KB |
Output is correct |
4 |
Correct |
0 ms |
5548 KB |
Output is correct |
5 |
Correct |
0 ms |
5548 KB |
Output is correct |
6 |
Correct |
0 ms |
5548 KB |
Output is correct |
7 |
Correct |
0 ms |
5548 KB |
Output is correct |
8 |
Correct |
0 ms |
5548 KB |
Output is correct |
9 |
Correct |
0 ms |
5548 KB |
Output is correct |
10 |
Correct |
0 ms |
5548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5548 KB |
Output is correct |
2 |
Correct |
0 ms |
5548 KB |
Output is correct |
3 |
Correct |
0 ms |
5548 KB |
Output is correct |
4 |
Correct |
0 ms |
5548 KB |
Output is correct |
5 |
Correct |
0 ms |
5548 KB |
Output is correct |
6 |
Correct |
0 ms |
5548 KB |
Output is correct |
7 |
Correct |
0 ms |
5548 KB |
Output is correct |
8 |
Correct |
0 ms |
5548 KB |
Output is correct |
9 |
Correct |
0 ms |
5548 KB |
Output is correct |
10 |
Correct |
0 ms |
5548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5548 KB |
Output is correct |
2 |
Correct |
0 ms |
5548 KB |
Output is correct |
3 |
Correct |
0 ms |
5548 KB |
Output is correct |
4 |
Correct |
0 ms |
5548 KB |
Output is correct |
5 |
Correct |
0 ms |
5548 KB |
Output is correct |
6 |
Correct |
0 ms |
5548 KB |
Output is correct |
7 |
Correct |
0 ms |
5548 KB |
Output is correct |
8 |
Correct |
0 ms |
5548 KB |
Output is correct |
9 |
Correct |
0 ms |
5548 KB |
Output is correct |
10 |
Correct |
0 ms |
5548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5548 KB |
Output is correct |
2 |
Correct |
0 ms |
5548 KB |
Output is correct |
3 |
Correct |
0 ms |
5548 KB |
Output is correct |
4 |
Correct |
0 ms |
5548 KB |
Output is correct |
5 |
Correct |
0 ms |
5548 KB |
Output is correct |
6 |
Correct |
4 ms |
5548 KB |
Output is correct |
7 |
Correct |
4 ms |
5548 KB |
Output is correct |
8 |
Correct |
0 ms |
5548 KB |
Output is correct |
9 |
Correct |
0 ms |
5548 KB |
Output is correct |
10 |
Correct |
0 ms |
5548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
5548 KB |
Output is correct |
2 |
Correct |
4 ms |
5548 KB |
Output is correct |
3 |
Correct |
8 ms |
5548 KB |
Output is correct |
4 |
Correct |
16 ms |
5548 KB |
Output is correct |
5 |
Correct |
4 ms |
5548 KB |
Output is correct |
6 |
Correct |
4 ms |
5548 KB |
Output is correct |
7 |
Correct |
4 ms |
5548 KB |
Output is correct |
8 |
Correct |
8 ms |
5548 KB |
Output is correct |
9 |
Correct |
12 ms |
5548 KB |
Output is correct |
10 |
Correct |
12 ms |
5548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
5548 KB |
Output is correct |
2 |
Correct |
12 ms |
5548 KB |
Output is correct |
3 |
Correct |
8 ms |
5548 KB |
Output is correct |
4 |
Correct |
8 ms |
5548 KB |
Output is correct |
5 |
Correct |
12 ms |
5548 KB |
Output is correct |
6 |
Correct |
16 ms |
5548 KB |
Output is correct |
7 |
Correct |
12 ms |
5548 KB |
Output is correct |
8 |
Correct |
8 ms |
5548 KB |
Output is correct |
9 |
Correct |
16 ms |
5548 KB |
Output is correct |
10 |
Correct |
16 ms |
5548 KB |
Output is correct |