Skip to content

Commit 6ea5af2

Browse files
authored
Create Dreams of Divisibility(Partial).cpp
1 parent ef42d36 commit 6ea5af2

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include <iostream>
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
5+
int main() {
6+
// your code goes here
7+
int t;
8+
cin>>t;
9+
while(t--) {
10+
int n,k;
11+
cin>>n>>k;
12+
int arr[n];
13+
set<int> s;
14+
int temp;
15+
for(int i=0;i<n;i++) {
16+
cin>>arr[i];
17+
temp=arr[i]%k;
18+
s.insert(temp);
19+
}
20+
int flag=0;
21+
for(int i=0;i<n;i++) {
22+
if(arr[i]%k!=0) {
23+
if(s.find(k-arr[i]%k)==s.end()) {
24+
flag=1;
25+
}
26+
}
27+
}
28+
if(flag==1) {
29+
cout<<"NO"<<"\n";
30+
}
31+
else {
32+
cout<<"YES"<<"\n";
33+
}
34+
}
35+
return 0;
36+
}

0 commit comments

Comments
 (0)