Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int n,b[1000003];
  5. bool a;
  6. int main()
  7. {
  8. cin>>n;
  9. for (int i=0; i<n; i++)
  10. {
  11. cin>>b[i];
  12. }
  13. sort(b,b+n);
  14. for (int i=0; i<n; i++)
  15. {
  16. if (i>1 && b[i]==b[i-1] && b[i]==b[i-1])
  17. {
  18. cout<<"NIE";
  19. return 0;
  20. }
  21. if (b[i]>=n)
  22. {
  23. cout<<"NIE";
  24. return 0;
  25. }
  26. if (b[i]==n-1 && b[0]==0 && b[1]==0 && b[i-1]!=n-1 && b[i+1]!=n-1)
  27. {
  28. cout<<"NIE";
  29. return 0;
  30. }
  31. if (b[i]==n-2 && b[i-1]!=n-2 && b[i+1]!=n-2)
  32. {
  33. cout<<"NIE";
  34. return 0;
  35. }
  36. }
  37. cout<<"TAK";
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement