We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef42d36 commit 6ea5af2Copy full SHA for 6ea5af2
Codechef/LTIME92B/Dreams of Divisibility(Partial).cpp
@@ -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
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