Advertisement
momo2345

distinct count

Jul 11th, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main(){
  4.     int t; cin>>t;while(t--){
  5.         int n,x;
  6.         cin>>n>>x;
  7.         vector<int>v(n);
  8.         for(int i=0;i<n;i++) cin>>v[i];
  9.         sort(v.begin(),v.end());
  10.         int sizes=unique(v.begin(),v.end())-v.begin();//the number of unique elements
  11.         if(x==sizes) puts("Good");
  12.         else if(x<sizes) puts("Average");
  13.         else puts("Bad");
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement