#include<iostream> #include<vector> #include<string> #include<map> #include<algorithm> using namespace std; int main() { int n; cin>>n; vector<string>v(n); map<string,int>mapa; for(int i=0;i<n;i++) { cin>>v[i]; if(mapa.find(v[i])==mapa.end() ) { mapa[v[i]]=1; } else { mapa[v[i]]++; } } vector<string>zadania={"1A","2A","3A","4A","1B","2B","3B","4B","1C","2C","3C","4C"}; vector<string>zadania_podwojne={"5A", "5B", "5C"}; bool flag = true; for(auto i : zadania) { if(mapa.find(i)==mapa.end()) { flag=false; cout<<"NIE"; return 0; } } for(auto i: zadania_podwojne) { if(mapa.find(i)==mapa.end() || mapa[i]<=1) { flag=false; 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 | #include<iostream> #include<vector> #include<string> #include<map> #include<algorithm> using namespace std; int main() { int n; cin>>n; vector<string>v(n); map<string,int>mapa; for(int i=0;i<n;i++) { cin>>v[i]; if(mapa.find(v[i])==mapa.end() ) { mapa[v[i]]=1; } else { mapa[v[i]]++; } } vector<string>zadania={"1A","2A","3A","4A","1B","2B","3B","4B","1C","2C","3C","4C"}; vector<string>zadania_podwojne={"5A", "5B", "5C"}; bool flag = true; for(auto i : zadania) { if(mapa.find(i)==mapa.end()) { flag=false; cout<<"NIE"; return 0; } } for(auto i: zadania_podwojne) { if(mapa.find(i)==mapa.end() || mapa[i]<=1) { flag=false; cout<<"NIE"; return 0; } } cout<<"TAK"; return 0; } |