-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1016.cpp
44 lines (44 loc) · 982 Bytes
/
1016.cpp
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
#include <iostream>
using namespace std;
int main()
{
int m;
cin >> m;
for (int i = 0;i < m;i++)
{
int n, x;
cin >> n >> x;
int hash[50000] = {};
int data[50000];
// data%49201
for (int j = 0;j < n;j++)
{
cin >> data[j];
if (!hash[data[j] % 49201])
hash[data[j] % 49201] = data[j];
else
{
int k = data[j] % 49201;
while (hash[k++]);
hash[k] = data[j];
}
}
int flag = 1;
for (int j = 0;j < n;j++)
{
int k = (x - data[j]) % 49201;
while (hash[k] != x - data[j] && hash[k])
{
k++;
}
if (hash[k])
{
flag = 0;
cout << "yes" << endl;
break;
}
}
if (flag)
cout << "no" << endl;
}
}