*** 第 1 點 (1%):AC (0ms, 264KB)
*** 第 2 點 (99%):WA (line:1)
丟到好灰心
一直WA
#include<stdio.h>
typedef unsigned long long huge;
huge a[1000001];
huge input(){
char cha;
huge x=0;
while(cha=getchar())if(cha!=' '&&cha!='\n')break;
x=cha-48;
while(cha=getchar()){
if(cha==' '||cha=='\n')break;
x=x*10+cha-48;
}
return x;
}
int binary(huge *item,int count,huge key){
int low=0,mid,high=count-1;
while(low<=high){
mid=(high+low)>>1;
if(key<item[mid])high=mid-1;
else if(key>item[mid])low=mid+1;
else return 1;
}
return 0;
}
huge (*p)(void);
int (*o)(huge *item,int count,huge key);
int main(void){
int m,n,t,i;
p=input;
o=binary;
scanf("%d%d",&n,&m);
while(n){
i=t=0;
while(t<m)a[t]=(*p)(),t++;
while(t--)i+=(*o)(a,m,(*p)());
printf("%d\n",i),n--;
}
return 0;
}