# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
11843 |
2014-12-12T06:46:45 Z |
gs14004 |
백신 (KOI13_vaccine) |
C++ |
|
32 ms |
4524 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(){
int n,k;
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+1 >= k) hash_virus[i].insert(ch);
if(j >= k) ch -= a[j-k] * chash[k];
}
reverse(a,a+m);
ch = 0;
for (int j=0; j<m; j++) {
ch *= 10007;
ch += a[j];
if(j+1 >= k) hash_virus[i].insert(ch);
if(j >= k) ch -= a[j-k] * chash[k];
}
}
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 |
Incorrect |
0 ms |
1224 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
Incorrect |
0 ms |
1224 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
Incorrect |
0 ms |
1224 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
Incorrect |
0 ms |
1224 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1620 KB |
Output is correct |
2 |
Correct |
8 ms |
2148 KB |
Output is correct |
3 |
Correct |
4 ms |
2544 KB |
Output is correct |
4 |
Incorrect |
32 ms |
4524 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
3204 KB |
Output is correct |
2 |
Correct |
20 ms |
4524 KB |
Output is correct |
3 |
Correct |
24 ms |
4392 KB |
Output is correct |
4 |
Incorrect |
16 ms |
3204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |