Advertisement
jakaria_hossain

codeforces - hilbert's hotel

May 8th, 2020
1,291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define fast()(ios_base::sync_with_stdio(0),cin.tie(NULL));
  5. int main()
  6. {
  7.     fast()
  8.     ll t;
  9.     cin>>t;
  10.     while(t--)
  11.     {
  12.         ll n;
  13.         cin>>n;
  14.         ll ara[n];
  15.         bool use[n],flg=true;;
  16.         fill(use,use+n,false);
  17.         for(ll i=0;i<n;i++)
  18.         {
  19.             cin>>ara[i];
  20.             ll x=(ara[i]+i)%n;
  21.             x=(x+n)%n;
  22.             if(use[x])flg=false;
  23.             use[x]=true;
  24.         }
  25.         if(flg)cout<<"YES"<<endl;
  26.         else cout<<"NO"<<endl;
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement