-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2040a.cpp
More file actions
38 lines (35 loc) · 850 Bytes
/
2040a.cpp
File metadata and controls
38 lines (35 loc) · 850 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
#include <bits/stdc++.h>
using namespace std;
#define NO cout<<"NO\n"
#define YES cout<<"YES\n"
#define F first
#define S second
#define cases int _; cin >> _; while(_--)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef set<int> si;
void solve() {
int n,k; cin >> n >> k;
vi A(n); for(int i = 0; i < n; i++) cin >> A[i];
bool u = false; int val=0;
if(n == 1) {YES; cout << 1 << '\n'; return;}
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
if(j == i && j+1 < n) j++;
if(abs(A[i]-A[j])%k == 0) {
u = true; break;
}
}
if(!u) {YES; cout << i+1 << '\n'; return;}
u=false;
}
NO; return;
}
int main() {
cases {
solve();
}
return 0;
}