/* ============================================================================== * * Author: * Name: Adam Jeliński * Nickname: charodziej <https://github.com/charodziej> * * Created: 18:41 07.12.2020 * * c.cpp * * g++ -std=c++17 -O3 -o c.o c.cpp * ./c.o * * ============================================================================== */ #include <bits/stdc++.h> using namespace std; #ifndef DEBUG #define DEBUG 0 #endif #if DEBUG==1 #include "/home/charodziej/Documents/universal-print-in-cpp/lib/universal_print.h" #else #define watch(...) #define watchb(...) #define declare_struct(...) namespace cupl{ void showTypes(...){return;} } #endif /* ============================================================================== * * /\ Please pardon the code above /\ * * || It is necessary for the debugging library to function properly || * * ============================================================================== */ typedef signed long long ll; typedef unsigned long long ull; int main(){ #if DEBUG==0 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #endif int n; cin >> n; int counts[3][5] = {{1, 1, 1, 1, 2}, {1, 1, 1, 1, 2}, {1, 1, 1, 1, 2}}; for (int i = 0; i < n; i++) { string in; cin >> in; counts[in[1] - 'A'][in[0] - '1']--; } for (int i = 0; i < 3; i++) { for (int j = 0; j < 5; j++) { if (counts[i][j] > 0) { cout << "NIE"; return 0; } } } cout << "TAK"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | /* ============================================================================== * * Author: * Name: Adam Jeliński * Nickname: charodziej <https://github.com/charodziej> * * Created: 18:41 07.12.2020 * * c.cpp * * g++ -std=c++17 -O3 -o c.o c.cpp * ./c.o * * ============================================================================== */ #include <bits/stdc++.h> using namespace std; #ifndef DEBUG #define DEBUG 0 #endif #if DEBUG==1 #include "/home/charodziej/Documents/universal-print-in-cpp/lib/universal_print.h" #else #define watch(...) #define watchb(...) #define declare_struct(...) namespace cupl{ void showTypes(...){return;} } #endif /* ============================================================================== * * /\ Please pardon the code above /\ * * || It is necessary for the debugging library to function properly || * * ============================================================================== */ typedef signed long long ll; typedef unsigned long long ull; int main(){ #if DEBUG==0 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #endif int n; cin >> n; int counts[3][5] = {{1, 1, 1, 1, 2}, {1, 1, 1, 1, 2}, {1, 1, 1, 1, 2}}; for (int i = 0; i < n; i++) { string in; cin >> in; counts[in[1] - 'A'][in[0] - '1']--; } for (int i = 0; i < 3; i++) { for (int j = 0; j < 5; j++) { if (counts[i][j] > 0) { cout << "NIE"; return 0; } } } cout << "TAK"; } |