-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkuroni.java
More file actions
24 lines (23 loc) · 688 Bytes
/
Copy pathkuroni.java
File metadata and controls
24 lines (23 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class kuroni {
static int mod=(int)1e9+7;
public static void main(String[] args) throws Exception {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt(),m=sc.nextInt();
int[] arr=new int[n];
for(int i=0;i<n;i++)arr[i]=sc.nextInt();
if(n>m) System.out.println(0);
else{
long ans=1;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
ans=(ans*Math.abs(arr[j]-arr[i]))%m;
}
}
System.out.println(ans);
}
}
}