Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int n,b[1000003];
- bool a;
- int main()
- {
- cin>>n;
- for (int i=0; i<n; i++)
- {
- cin>>b[i];
- }
- sort(b,b+n);
- for (int i=0; i<n; i++)
- {
- if (i>1 && b[i]==b[i-1] && b[i]==b[i-1])
- {
- cout<<"NIE";
- return 0;
- }
- if (b[i]>=n)
- {
- cout<<"NIE";
- return 0;
- }
- if (b[i]==n-1 && b[0]==0 && b[1]==0 && b[i-1]!=n-1 && b[i+1]!=n-1)
- {
- cout<<"NIE";
- return 0;
- }
- if (b[i]==n-2 && b[i-1]!=n-2 && b[i+1]!=n-2)
- {
- cout<<"NIE";
- return 0;
- }
- }
- cout<<"TAK";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement