Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <unordered_set>
- using namespace std;
- typedef long long LL;
- int main() {
- int N, M;
- cin >> N;
- cin >> M;
- LL *lookup = new LL[N+1];
- for (int i = 1; i <= N; i++) {
- lookup[i] = 0;
- }
- int end = N / 2;
- int k;
- for (int i = 0; i < M; i++) {
- for (int j = 0; j < end; j++) {
- cin >> k;
- lookup[k] *= 2;
- }
- for (int j = 0; j < end; j++) {
- cin >> k;
- lookup[k] = lookup[k] * 2 + 1;
- }
- }
- bool success = true;
- unordered_set<LL> all_nums;
- LL K;
- for (int i = 1; i <= N && success; i++) {
- K = lookup[i];
- if (all_nums.find(K) != all_nums.end()) {
- success = false;
- } else {
- all_nums.insert(K);
- }
- }
- cout << (success ? "TAK" : "NIE") << endl;
- delete [] lookup;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement