// Andrzej Radzik #include <iostream> int main() { std::cin.tie( 0 ); int array[ 15 ]; int tasks; int roundNum; int i; char division; bool succes = true; for ( i = 0; i < 15; i++ ) { array[ i ] = 0; } std::cin >> tasks; while ( tasks > 0 ) { std::cin >> roundNum; std::cin >> division; array[ (division - 'A') * 5 + roundNum - 1 ] += 1; tasks--; } for ( i = 0; i < 15; i++ ) { if ( i % 5 == 4 ) { if ( array[ i ] <= 1 ) { succes = false; } } else { if ( array[ i ] <= 0 ) { succes = false; } } } if ( succes ) std::cout << "TAK" << std::endl; else std::cout << "NIE" << std::endl; 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 | // Andrzej Radzik #include <iostream> int main() { std::cin.tie( 0 ); int array[ 15 ]; int tasks; int roundNum; int i; char division; bool succes = true; for ( i = 0; i < 15; i++ ) { array[ i ] = 0; } std::cin >> tasks; while ( tasks > 0 ) { std::cin >> roundNum; std::cin >> division; array[ (division - 'A') * 5 + roundNum - 1 ] += 1; tasks--; } for ( i = 0; i < 15; i++ ) { if ( i % 5 == 4 ) { if ( array[ i ] <= 1 ) { succes = false; } } else { if ( array[ i ] <= 0 ) { succes = false; } } } if ( succes ) std::cout << "TAK" << std::endl; else std::cout << "NIE" << std::endl; return 0; } |