#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, b, i, j;
while(cin >> n >> b)
{
if(n == 0 && b == 0)
break;
int a[b+1];
map<int, int>mp;
for(i=1;i<=b;i++)
cin >> a[i];
for(i=1;i<b;i++)
{
for(j=i+1;j<=b;j++)
{
int p = abs(a[i] - a[j]);
mp[p] = 1;
}
}
int f = 1;
for(i=1;i<=n;i++)
{
if(mp[i] == 0)
{
f = 0;
break;
}
}
if(f == 1)
cout << "Y" << "\n";
else
cout << "N" << "\n";
}
return 0;
}
using namespace std;
int main()
{
int n, b, i, j;
while(cin >> n >> b)
{
if(n == 0 && b == 0)
break;
int a[b+1];
map<int, int>mp;
for(i=1;i<=b;i++)
cin >> a[i];
for(i=1;i<b;i++)
{
for(j=i+1;j<=b;j++)
{
int p = abs(a[i] - a[j]);
mp[p] = 1;
}
}
int f = 1;
for(i=1;i<=n;i++)
{
if(mp[i] == 0)
{
f = 0;
break;
}
}
if(f == 1)
cout << "Y" << "\n";
else
cout << "N" << "\n";
}
return 0;
}
Comments
Post a Comment