-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path12239 Bingo.cpp
46 lines (42 loc) · 903 Bytes
/
12239 Bingo.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
45
46
#include <bits/stdc++.h>
using namespace std;
int arr[10004];
int main()
{
int n, m;
while(cin >> n >> m)
{
if (n == 0 && m == 0)
break;
// set <int> st;
int aarr[1005]={0};
for(int i = 0; i < m; i++)
cin >>arr[i];
set <int> st;
for(int i = 0; i < m; i++)
{
for(int j = i; j < m; j++)
{
st.insert(abs(arr[i] - arr[j]));
}
}
set <int> :: iterator it;
bool vs[100005] = {false};
for(it = st.begin(); it != st.end(); it++)
vs[*it] = true;
bool f = false;
for(int i = 0; i <= n; i++)
{
if(vs[i] == false)
{
f = true;
break;
}
}
if(!f)
cout<<"Y";
else
cout<<"N";
cout<< endl;
}
}