Submission #7408

# Submission time Handle Problem Language Result Execution time Memory
7408 2014-08-05T04:01:21 Z gs13068 백신 (KOI13_vaccine) C++
2.64 / 24
556 ms 2260 KB
#include<cstdio>
#include<algorithm>

int a[100][1000];
int an[100];

long long key[100][1000];

long long hash(int i,int j,int k)
{
  long long res=0;
  int t;
  for(t=0;t<k;t++)res=res*10000+a[i][j+t];
  return res;
}

long long hash2(int i,int j,int k)
{
  long long res=0;
  int t;
  for(t=1;t<=k;t++)res=res*10000+a[i][j+k-t];
  return res;
}

int main()
{
  int i,j,n,m;
  scanf("%d%d",&n,&m);
  for(i=0;i<n;i++)
  {
    scanf("%d",&an[i]);
    for(j=0;j<an[i];j++)scanf("%d",&a[i][j]);
  }
  for(i=0;i<n;i++)for(j=0;j<an[i]-m+1;j++)
  {
    key[i][j*2]=hash(i,j,m);
    key[i][j*2+1]=hash2(i,j,m);
  }
  for(i=0;i<n;i++)std::sort(key[i],key[i]+2*(an[i]-m+1));
  for(j=0;j<2*(an[0]-m+1);j++)
  {
    for(i=1;i<n;i++)if(!std::binary_search(key[i],key[i]+2*(an[i]-m+1),key[0][j]))break;
    if(i==n)break;
  }
  if(j==2*(an[0]-m+1))puts("NO");
  else puts("YES");
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2260 KB Output is correct
2 Correct 0 ms 2260 KB Output is correct
3 Correct 0 ms 2260 KB Output is correct
4 Correct 0 ms 2260 KB Output is correct
5 Correct 0 ms 2260 KB Output is correct
6 Correct 0 ms 2260 KB Output is correct
7 Correct 0 ms 2260 KB Output is correct
8 Correct 0 ms 2260 KB Output is correct
9 Correct 0 ms 2260 KB Output is correct
10 Correct 0 ms 2260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2260 KB Output is correct
2 Correct 0 ms 2260 KB Output is correct
3 Correct 0 ms 2260 KB Output is correct
4 Correct 0 ms 2260 KB Output is correct
5 Incorrect 0 ms 2260 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2260 KB Output is correct
2 Correct 0 ms 2260 KB Output is correct
3 Correct 0 ms 2260 KB Output is correct
4 Correct 0 ms 2260 KB Output is correct
5 Correct 0 ms 2260 KB Output is correct
6 Correct 0 ms 2260 KB Output is correct
7 Correct 0 ms 2260 KB Output is correct
8 Correct 0 ms 2260 KB Output is correct
9 Correct 0 ms 2260 KB Output is correct
10 Incorrect 0 ms 2260 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2260 KB Output is correct
2 Correct 0 ms 2260 KB Output is correct
3 Correct 0 ms 2260 KB Output is correct
4 Correct 0 ms 2260 KB Output is correct
5 Correct 0 ms 2260 KB Output is correct
6 Correct 0 ms 2260 KB Output is correct
7 Incorrect 0 ms 2260 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2260 KB Output is correct
2 Correct 12 ms 2260 KB Output is correct
3 Correct 16 ms 2260 KB Output is correct
4 Correct 84 ms 2260 KB Output is correct
5 Correct 4 ms 2260 KB Output is correct
6 Correct 12 ms 2260 KB Output is correct
7 Correct 12 ms 2260 KB Output is correct
8 Correct 36 ms 2260 KB Output is correct
9 Correct 48 ms 2260 KB Output is correct
10 Incorrect 44 ms 2260 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 2260 KB Output is correct
2 Correct 60 ms 2260 KB Output is correct
3 Correct 96 ms 2260 KB Output is correct
4 Correct 28 ms 2260 KB Output is correct
5 Correct 68 ms 2260 KB Output is correct
6 Correct 92 ms 2260 KB Output is correct
7 Correct 84 ms 2260 KB Output is correct
8 Correct 56 ms 2260 KB Output is correct
9 Runtime error 556 ms 2256 KB SIGSEGV Segmentation fault
10 Halted 0 ms 0 KB -