#include <iostream> #include <map> using namespace std; typedef unsigned long UINT; /** Redirect stdin to provide input with Qt Creator */ void reopenInput(int argc, char** argv) { #ifdef LOCAL if (argc > 1) { auto inFile = argv[1]; cerr << "Reopening stdin to: " << inFile << endl; auto success = freopen(inFile, "r", stdin); if (!success) { cerr << "Error when opening file!" << endl; cerr << std::strerror(errno) << endl; } } #endif } int main(int argc, char** argv) { reopenInput(argc, argv); map<string, UINT> tasks; UINT n; string task; cin >> n; while (cin >> task) { tasks[task] += 1; auto val = 1; cerr << "Task " << task << " is now " << tasks[task] << " times." <<endl; } if ( tasks["1A"] >= 1 && tasks["1B"] >= 1 && tasks["1C"] >= 1 && tasks["2A"] >= 1 && tasks["2B"] >= 1 && tasks["2C"] >= 1 && tasks["3A"] >= 1 && tasks["3B"] >= 1 && tasks["3C"] >= 1 && tasks["4A"] >= 1 && tasks["4B"] >= 1 && tasks["4C"] >= 1 && tasks["5A"] >= 2 && tasks["5B"] >= 2 && tasks["5C"] >= 2 ) { cout << "TAK" << endl; } else { cout << "NIE" << endl; } #if LOCAL cerr << "1A: " << tasks["1A"] << endl; cerr << "1B: " << tasks["1B"] << endl; cerr << "1C: " << tasks["1C"] << endl; cerr << "2A: " << tasks["2A"] << endl; cerr << "2B: " << tasks["2B"] << endl; cerr << "2C: " << tasks["2C"] << endl; cerr << "3A: " << tasks["3A"] << endl; cerr << "3B: " << tasks["3B"] << endl; cerr << "3C: " << tasks["3C"] << endl; cerr << "4A: " << tasks["4A"] << endl; cerr << "4B: " << tasks["4B"] << endl; cerr << "4C: " << tasks["4C"] << endl; cerr << "5A: " << tasks["5A"] << endl; cerr << "5B: " << tasks["5B"] << endl; cerr << "5C: " << tasks["5C"] << endl; #endif 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #include <iostream> #include <map> using namespace std; typedef unsigned long UINT; /** Redirect stdin to provide input with Qt Creator */ void reopenInput(int argc, char** argv) { #ifdef LOCAL if (argc > 1) { auto inFile = argv[1]; cerr << "Reopening stdin to: " << inFile << endl; auto success = freopen(inFile, "r", stdin); if (!success) { cerr << "Error when opening file!" << endl; cerr << std::strerror(errno) << endl; } } #endif } int main(int argc, char** argv) { reopenInput(argc, argv); map<string, UINT> tasks; UINT n; string task; cin >> n; while (cin >> task) { tasks[task] += 1; auto val = 1; cerr << "Task " << task << " is now " << tasks[task] << " times." <<endl; } if ( tasks["1A"] >= 1 && tasks["1B"] >= 1 && tasks["1C"] >= 1 && tasks["2A"] >= 1 && tasks["2B"] >= 1 && tasks["2C"] >= 1 && tasks["3A"] >= 1 && tasks["3B"] >= 1 && tasks["3C"] >= 1 && tasks["4A"] >= 1 && tasks["4B"] >= 1 && tasks["4C"] >= 1 && tasks["5A"] >= 2 && tasks["5B"] >= 2 && tasks["5C"] >= 2 ) { cout << "TAK" << endl; } else { cout << "NIE" << endl; } #if LOCAL cerr << "1A: " << tasks["1A"] << endl; cerr << "1B: " << tasks["1B"] << endl; cerr << "1C: " << tasks["1C"] << endl; cerr << "2A: " << tasks["2A"] << endl; cerr << "2B: " << tasks["2B"] << endl; cerr << "2C: " << tasks["2C"] << endl; cerr << "3A: " << tasks["3A"] << endl; cerr << "3B: " << tasks["3B"] << endl; cerr << "3C: " << tasks["3C"] << endl; cerr << "4A: " << tasks["4A"] << endl; cerr << "4B: " << tasks["4B"] << endl; cerr << "4C: " << tasks["4C"] << endl; cerr << "5A: " << tasks["5A"] << endl; cerr << "5B: " << tasks["5B"] << endl; cerr << "5C: " << tasks["5C"] << endl; #endif return 0; } |