
请问我的代码为什么是零分呢
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int n=scanner.nextInt();
int m=scanner.nextInt();
int a[]=new int[n];
int q[]=new int[m];
for(int i=0;i<n;i++)
{
a[i]=scanner.nextInt();
}
for(int j=0;j<m;j++)
{
q[j]=scanner.nextInt();
}
//以上为输入
for(int j=0;j<m;j++)
{
int target=q[j];
int left=0;
int right=n-1;
while (left <= right) {
int middle = left + ((right - left) / 2);
if (a[middle] >= target) {
right = middle - 1;
} else if (a[middle] < target) {
left = middle + 1;
}
}
if (a[left] == target) {
System.out.print(left+1+" ");
}
else{
System.out.print("-1"+" ");
}
}
}
}