# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
11854 |
2014-12-12T08:55:12 Z |
gs14004 |
백신 (KOI13_vaccine) |
C++ |
|
32 ms |
4656 KB |
#include <cstdio>
#include <algorithm>
#include <set>
using namespace std;
set<long long> hash_virus[101];
long long chash[1005];
int n,k;
int fnd(long long x){
for (int i=1; i<n; i++) {
if(hash_virus[i].find(x) == hash_virus[i].end()) return 0;
}
return 1;
}
int main(){
scanf("%d %d",&n,&k);
chash[0] = 1;
for (int i=1; i<=k; i++) {
chash[i] = chash[i-1] * 10007;
}
for (int i=0; i<n; i++) {
int m, a[1005] ={};
scanf("%d",&m);
for (int j=0; j<m; j++) {
scanf("%d",&a[j]);
}
long long ch = 0;
for (int j=0; j<m; j++) {
ch *= 10007;
ch += a[j];
if(j >= k) ch -= a[j-k] * chash[k];
if(j+1 >= k) hash_virus[i].insert(ch);
}
reverse(a,a+m);
ch = 0;
for (int j=0; j<m; j++) {
ch *= 10007;
ch += a[j];
if(j >= k) ch -= a[j-k] * chash[k];
if(j+1 >= k) hash_virus[i].insert(ch);
}
}
set<long long> ::iterator it = hash_virus[0].begin();
while (it != hash_virus[0].end()) {
if(fnd(*it)){
puts("YES");
return 0;
}
it++;
}
puts("NO");
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1224 KB |
Output is correct |
2 |
Correct |
0 ms |
1224 KB |
Output is correct |
3 |
Correct |
0 ms |
1224 KB |
Output is correct |
4 |
Correct |
0 ms |
1224 KB |
Output is correct |
5 |
Correct |
0 ms |
1224 KB |
Output is correct |
6 |
Correct |
0 ms |
1224 KB |
Output is correct |
7 |
Correct |
0 ms |
1224 KB |
Output is correct |
8 |
Correct |
0 ms |
1224 KB |
Output is correct |
9 |
Correct |
0 ms |
1224 KB |
Output is correct |
10 |
Correct |
0 ms |
1224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1224 KB |
Output is correct |
2 |
Correct |
0 ms |
1224 KB |
Output is correct |
3 |
Correct |
0 ms |
1224 KB |
Output is correct |
4 |
Correct |
0 ms |
1224 KB |
Output is correct |
5 |
Correct |
0 ms |
1224 KB |
Output is correct |
6 |
Correct |
0 ms |
1224 KB |
Output is correct |
7 |
Correct |
0 ms |
1224 KB |
Output is correct |
8 |
Correct |
0 ms |
1224 KB |
Output is correct |
9 |
Correct |
0 ms |
1224 KB |
Output is correct |
10 |
Correct |
0 ms |
1224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1224 KB |
Output is correct |
2 |
Correct |
0 ms |
1224 KB |
Output is correct |
3 |
Correct |
0 ms |
1224 KB |
Output is correct |
4 |
Correct |
0 ms |
1224 KB |
Output is correct |
5 |
Correct |
0 ms |
1224 KB |
Output is correct |
6 |
Correct |
0 ms |
1224 KB |
Output is correct |
7 |
Correct |
0 ms |
1224 KB |
Output is correct |
8 |
Correct |
0 ms |
1224 KB |
Output is correct |
9 |
Correct |
0 ms |
1224 KB |
Output is correct |
10 |
Correct |
0 ms |
1224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1224 KB |
Output is correct |
2 |
Correct |
0 ms |
1356 KB |
Output is correct |
3 |
Correct |
0 ms |
1356 KB |
Output is correct |
4 |
Correct |
0 ms |
1224 KB |
Output is correct |
5 |
Correct |
0 ms |
1224 KB |
Output is correct |
6 |
Correct |
0 ms |
1356 KB |
Output is correct |
7 |
Correct |
0 ms |
1356 KB |
Output is correct |
8 |
Correct |
0 ms |
1224 KB |
Output is correct |
9 |
Correct |
0 ms |
1356 KB |
Output is correct |
10 |
Correct |
0 ms |
1356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1620 KB |
Output is correct |
2 |
Correct |
4 ms |
2148 KB |
Output is correct |
3 |
Correct |
8 ms |
2544 KB |
Output is correct |
4 |
Correct |
24 ms |
4524 KB |
Output is correct |
5 |
Correct |
4 ms |
1620 KB |
Output is correct |
6 |
Correct |
4 ms |
2148 KB |
Output is correct |
7 |
Correct |
4 ms |
2544 KB |
Output is correct |
8 |
Correct |
8 ms |
1224 KB |
Output is correct |
9 |
Correct |
12 ms |
1224 KB |
Output is correct |
10 |
Correct |
24 ms |
4128 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
3204 KB |
Output is correct |
2 |
Correct |
28 ms |
4524 KB |
Output is correct |
3 |
Correct |
24 ms |
4392 KB |
Output is correct |
4 |
Correct |
12 ms |
3204 KB |
Output is correct |
5 |
Correct |
16 ms |
4524 KB |
Output is correct |
6 |
Correct |
24 ms |
4392 KB |
Output is correct |
7 |
Correct |
28 ms |
4524 KB |
Output is correct |
8 |
Correct |
16 ms |
1224 KB |
Output is correct |
9 |
Correct |
20 ms |
4656 KB |
Output is correct |
10 |
Correct |
32 ms |
4656 KB |
Output is correct |