Advertisement
Saleh127

LO 1374

Aug 12th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.  
  6. int t,l;
  7. cin>>t;
  8. for(l=1;l<=t;l++)
  9. {
  10. int a[200005]={0},n,c,i,j=0,k;
  11. cin>>n;
  12. for(i=0;i<n;i++)
  13. {
  14. cin>>c;
  15. if(c>=0 && c<n)
  16. {
  17. a[c]++;
  18. }
  19. }
  20. cout<<"Case "<<l<<": ";
  21. for(i=0;i<n;i++)
  22. {
  23. if(a[i]>0)
  24. {
  25. a[i]--;
  26. j++;
  27. }
  28. else if(a[n-i-1]>0)
  29. {
  30. a[n-i-1]--;
  31. j++;
  32. }
  33. }
  34. if(j==n) cout<<"yes"<<endl;
  35. else cout<<"no"<<endl;
  36. }
  37. return 0;
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement