#include <iostream> #include <bits/stdc++.h> #define ll long long #define ld long double #define pii pair<int,int> #define pll pair<ll,ll> #define fi first #define se second using namespace std; int main() { int t; cin >> t; unordered_map<string, int> exercises; string ex; while(t--) { cin >> ex; if(exercises.find(ex) == exercises.end()) exercises[ex] = 1; else { exercises[ex]++; } } vector<pair<string, int>> vecExercises; for(auto ex: exercises) { vecExercises.push_back(make_pair(ex.fi, ex.se)); } sort(vecExercises.begin(), vecExercises.end()); for(int i = 0; i < 12; i++) { if( vecExercises[i].se < 1){ cout << "NIE"; return 0; } } for(int i = 12; i < 15; i++) { if(vecExercises[i].se < 2) { cout << "NIE"; return 0; } } cout << "TAK"; return 0; }
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 | #include <iostream> #include <bits/stdc++.h> #define ll long long #define ld long double #define pii pair<int,int> #define pll pair<ll,ll> #define fi first #define se second using namespace std; int main() { int t; cin >> t; unordered_map<string, int> exercises; string ex; while(t--) { cin >> ex; if(exercises.find(ex) == exercises.end()) exercises[ex] = 1; else { exercises[ex]++; } } vector<pair<string, int>> vecExercises; for(auto ex: exercises) { vecExercises.push_back(make_pair(ex.fi, ex.se)); } sort(vecExercises.begin(), vecExercises.end()); for(int i = 0; i < 12; i++) { if( vecExercises[i].se < 1){ cout << "NIE"; return 0; } } for(int i = 12; i < 15; i++) { if(vecExercises[i].se < 2) { cout << "NIE"; return 0; } } cout << "TAK"; return 0; } |