Advertisement
erfanul007

LOJ 1374

Dec 16th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef unsigned long long int ull;
  5. typedef long long int ll;
  6. typedef vector<int> vi;
  7. typedef vector<ll> vll;
  8. typedef vector<vi> vvi;
  9. typedef pair<int,int > pii;
  10. typedef vector< pii > vpii;
  11. typedef set<int> sti;
  12.  
  13. #define sc scanf
  14. #define pf printf
  15. #define sci(n) scanf("%d",&n)
  16. #define scii(n,m) scanf("%d %d",&n,&m)
  17. #define scl(n) scanf("%lld",&n)
  18. #define scd(n) scanf("%lf",&n)
  19. #define scs(s) scanf("%s",s)
  20. #define pfi(n) printf("%d",n)
  21. #define pfl(n) printf("%lld",n)
  22. #define pff(n) cout<<n
  23. #define line printf("\n")
  24. #define spc printf(" ")
  25. #define clr(a,x) memset(a,x,sizeof(a))
  26. #define loop(i,x,y) for(int i=int(x); i<=int(y); i++)
  27. #define rloop(i,y,x) for(int i=int(y); i>=int(x); i--)
  28. #define cspf(i) printf("Case %d: ", i)
  29. #define vout(v) for(int w=0;w<v.size();w++){if(w) cout<<' '; cout<<v[w];}
  30. #define pb push_back
  31. #define mp make_pair
  32. #define ff first
  33. #define ss second
  34. #define all(v) v.begin(),v.end()
  35. #define rall(v) v.rbegin(),v.rend()
  36. #define read() freopen("input.txt", "r", stdin)
  37. #define write() freopen("output.txt", "w", stdout)
  38. #define fastIO() ios_base::sync_with_stdio(false); cin.tie(NULL);
  39. /// Constants
  40. #define eps 1e-9
  41. #define PI acos(-1.0) // 3.1415926535897932
  42. #define MAX 1e9
  43. #define MOD 1000007
  44.  
  45. ll GCD(ll a, ll b) { return b == 0 ? a : GCD(b , a % b); }
  46. ll LCM(ll a, ll b) { return a * (b/GCD(a, b)); }
  47.  
  48. int cnt[1000005];
  49.  
  50. int main()
  51. {
  52. read();
  53. write();
  54.  
  55. int t;
  56. sci(t);
  57. loop(ca,1,t){
  58. int n,x;
  59. sci(n);
  60. clr(cnt,0);
  61. loop(i,1,n){
  62. sci(x);
  63. cnt[x]++;
  64. }
  65. bool flg=true;
  66. loop(i,1,n){
  67. if(cnt[i-1]) cnt[i-1]--;
  68. else if(cnt[n-i]) cnt[n-i]--;
  69. else{
  70. flg=false;
  71. break;
  72. }
  73. }
  74. cspf(ca);
  75. if(flg) pf("yes\n");
  76. else pf("no\n");
  77. }
  78. return 0;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement