Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <algorithm>
- #include <cstring>
- #include <string>
- #include <cctype>
- #include <vector>
- #include <map>
- #include <set>
- #include <cmath>
- #define For(a) for ( i = 0; i < a; i++ )
- #define Rep(a, b) for ( i = a; i <= b; i++ )
- #define N 1000000
- using namespace std;
- int main() {
- int n,b,i,val,tmp;
- while(scanf("%d %d",&n,&b)){
- if(n==0 && b==0) break;
- vector<int> array;
- set<int> aux;
- For(b){
- scanf("%d", &val);
- array.push_back(val);
- }
- for (i=0;i<array.size();i++){
- for(int j=0;j<array.size();j++){
- tmp = abs(array[i] - array[j]);
- aux.insert(tmp);
- }
- }
- if(aux.size() == n+1)
- printf("Y\n");
- else printf("N\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement