Advertisement
Mizuhara_Chizuru

Untitled

Aug 28th, 2021
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. /*Code by Surya a.k.a Sunny*/
  2. /* by https://www.codechef.com/users/spsc */
  3. #include <bits/stdc++.h>
  4. //#include <boost/multiprecision/cpp_int.hpp>
  5. #define lli long long
  6. #define pi 3.14159265358979323846
  7. #define MOD 1000000007
  8. #define foi(n)  for(lli i=0;i<n;i++)
  9. #define foj(n)  for(lli j=0;j<n;j++)
  10. #define test(T) lli T;cin>>T;while(T--)
  11. #define loop(i, a, b) for(int i = (a); i<= (b); i++)
  12. using namespace std;
  13. //using namespace boost::multiprecision;
  14. int main()
  15. {
  16.   ios_base::sync_with_stdio(false);
  17.    cin.tie(NULL);
  18.    cout.tie(NULL);
  19.    test(T)
  20.    {
  21.       lli n,k,count=0;
  22.       cin>>n>>k;
  23.       lli a[n];
  24.       foi(n)
  25.           cin>>a[i];
  26.         sort(a,a+n);
  27.         for(int i=0;i<n;i+=k)
  28.           {
  29.             count++;
  30.             while(a[i]==a[i+1])
  31.               i++;
  32.           }
  33.         cout<<count<<'\n';
  34.    }
  35.  }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement