// originally t-rex was going to break into the radio station instead, commandeering it for a
// batman call-in show ''that the public demands'', but i didn't want to have him to spend his
// 1000th code in jail :(
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, a, n) for (int i = a; i < (int)(n); i++)
#define per(i, a, n) for (int i = (n)-1; i >= (int)(a); i--)
template <typename T, typename U>
ostream& operator<<(ostream& _s, pair<T, U> _t) {
_s << "(" << _t.first << "," << _t.second << ")";
return _s;
}
template <typename T, typename U>
istream& operator>>(istream& _s, pair<T, U>& _t) {
_s >> _t.first >> _t.second;
return _s;
}
template <typename T>
ostream& operator<<(ostream& _s, vector<T> _t) {
rep(i, 0, _t.size()) _s << (i ? " " : "") << _t[i];
return _s;
}
template <typename T>
istream& operator>>(istream& _s, vector<T>& _t) {
rep(i, 0, _t.size()) _s >> _t[i];
return _s;
}
template <typename T>
ostream& operator<<(ostream& _s, vector<vector<T>> _t) {
rep(i, 0, _t.size()) { _s << i << ": " << _t[i] << endl; }
return _s;
}
int main() {
ios_base::sync_with_stdio(false);
map<string,int> need;
rep(i,1,6) {
rep(c,'A','D') {
string s = to_string(i) + char(c);
need[s] = 1 + (i == 5);
}
}
int n;
cin >> n;
rep(i,0,n) {
string s;
cin >> s;
need[s]--;
}
bool ok = true;
for (auto x : need) {
if (x.second > 0) {
ok = false;
}
}
cout << (ok ? "TAK" : "NIE") << endl;
}
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 69 70 71 72 73 74 75 76 | // originally t-rex was going to break into the radio station instead, commandeering it for a // batman call-in show ''that the public demands'', but i didn't want to have him to spend his // 1000th code in jail :( #include <algorithm> #include <cassert> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; using ll = int64_t; #define rep(i, a, n) for (int i = a; i < (int)(n); i++) #define per(i, a, n) for (int i = (n)-1; i >= (int)(a); i--) template <typename T, typename U> ostream& operator<<(ostream& _s, pair<T, U> _t) { _s << "(" << _t.first << "," << _t.second << ")"; return _s; } template <typename T, typename U> istream& operator>>(istream& _s, pair<T, U>& _t) { _s >> _t.first >> _t.second; return _s; } template <typename T> ostream& operator<<(ostream& _s, vector<T> _t) { rep(i, 0, _t.size()) _s << (i ? " " : "") << _t[i]; return _s; } template <typename T> istream& operator>>(istream& _s, vector<T>& _t) { rep(i, 0, _t.size()) _s >> _t[i]; return _s; } template <typename T> ostream& operator<<(ostream& _s, vector<vector<T>> _t) { rep(i, 0, _t.size()) { _s << i << ": " << _t[i] << endl; } return _s; } int main() { ios_base::sync_with_stdio(false); map<string,int> need; rep(i,1,6) { rep(c,'A','D') { string s = to_string(i) + char(c); need[s] = 1 + (i == 5); } } int n; cin >> n; rep(i,0,n) { string s; cin >> s; need[s]--; } bool ok = true; for (auto x : need) { if (x.second > 0) { ok = false; } } cout << (ok ? "TAK" : "NIE") << endl; } |
English