Submission #7407

#TimeUsernameProblemLanguageResultExecution timeMemory
7407gs13068백신 (KOI13_vaccine)C++98
0 / 24
92 ms2260 KiB
#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]=hash(i,j,m); } for(i=0;i<n;i++)std::sort(a[i],a[i]+2*(an[i]-m+1)); for(j=0;j<2*(an[i]-m+1);j++) { for(i=1;i<n;i++)if(!std::binary_search(a[i],a[i]+2*(an[i]-m+1),a[0][j]))break; if(i==n)break; } if(j==2*(an[i]-m+1))puts("NO"); else puts("YES"); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...