답안 #7409

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
7409 2014-08-05T04:02:54 Z gs13068 백신 (KOI13_vaccine) C++
2.64 / 24
96 ms 3040 KB
#include<cstdio>
#include<algorithm>

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

long long key[100][2000];

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");
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3040 KB Output is correct
2 Correct 0 ms 3040 KB Output is correct
3 Correct 0 ms 3040 KB Output is correct
4 Correct 0 ms 3040 KB Output is correct
5 Correct 0 ms 3040 KB Output is correct
6 Correct 0 ms 3040 KB Output is correct
7 Correct 0 ms 3040 KB Output is correct
8 Correct 0 ms 3040 KB Output is correct
9 Correct 0 ms 3040 KB Output is correct
10 Correct 0 ms 3040 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3040 KB Output is correct
2 Correct 0 ms 3040 KB Output is correct
3 Correct 0 ms 3040 KB Output is correct
4 Correct 0 ms 3040 KB Output is correct
5 Incorrect 0 ms 3040 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3040 KB Output is correct
2 Correct 0 ms 3040 KB Output is correct
3 Correct 0 ms 3040 KB Output is correct
4 Correct 0 ms 3040 KB Output is correct
5 Correct 0 ms 3040 KB Output is correct
6 Correct 0 ms 3040 KB Output is correct
7 Correct 0 ms 3040 KB Output is correct
8 Correct 0 ms 3040 KB Output is correct
9 Correct 0 ms 3040 KB Output is correct
10 Incorrect 0 ms 3040 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3040 KB Output is correct
2 Correct 0 ms 3040 KB Output is correct
3 Correct 0 ms 3040 KB Output is correct
4 Correct 0 ms 3040 KB Output is correct
5 Correct 0 ms 3040 KB Output is correct
6 Correct 0 ms 3040 KB Output is correct
7 Incorrect 0 ms 3040 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3040 KB Output is correct
2 Correct 12 ms 3040 KB Output is correct
3 Correct 12 ms 3040 KB Output is correct
4 Correct 96 ms 3040 KB Output is correct
5 Correct 0 ms 3040 KB Output is correct
6 Correct 12 ms 3040 KB Output is correct
7 Correct 16 ms 3040 KB Output is correct
8 Correct 32 ms 3040 KB Output is correct
9 Correct 60 ms 3040 KB Output is correct
10 Incorrect 40 ms 3040 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 3040 KB Output is correct
2 Correct 64 ms 3040 KB Output is correct
3 Correct 96 ms 3040 KB Output is correct
4 Correct 28 ms 3040 KB Output is correct
5 Correct 64 ms 3040 KB Output is correct
6 Correct 96 ms 3040 KB Output is correct
7 Correct 92 ms 3040 KB Output is correct
8 Correct 56 ms 3040 KB Output is correct
9 Incorrect 92 ms 3040 KB Output isn't correct
10 Halted 0 ms 0 KB -