-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path20400.cpp
More file actions
50 lines (37 loc) · 884 Bytes
/
20400.cpp
File metadata and controls
50 lines (37 loc) · 884 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <bits/stdc++.h>
#define ll long long
#define forn(i, n) for (int i = 0; i < n; i++)
#define read(a) for (auto &i : a) cin >> i
#define yn(a) cout << (a ? "YES" : "NO") << endl
using namespace std;
typedef vector<int> vi;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
int n, k;
cin >> n >> k;
vi a(n);
read(a);
int f = 0;
for (int i = 0; i < n; i++) {
int ct = 0;
for (int j = 0; j < n; j++) {
if(j != i){
int x = abs(a[i]- a[j]);
if(x % k != 0) ct++;
}
}
if(ct == n-1){
cout<<"YES"<<endl;
cout<<i+1<<endl;
f = 1;
break;
}
}
if(f == 0) cout<<"NO"<<endl;
}
return 0;
}