// PA2025 runda 1C - https://sio2.mimuw.edu.pl/c/pa-2025-1/p/fin/ //-std=c++20 #include<iostream> #include <algorithm> #include <vector> #include <tuple> using namespace std; u_int32_t n; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n; bool finito = false; int i = 0; int j = 0; while (!finito) { i++; string s; int x; cin >> s >> x; if ((s == "TAK") && ((j < 10) || (x < 2))) { j++; cout << i << ' '; } finito = (j == 20 || i == n); if (j > 20) { throw std::runtime_error("j>20"); } } //for (; i < n; i++) { // todo sprawdz czy trzeba wczytac cale wejscie // string s; // int x; // cin >> s >> x; //} }
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 | // PA2025 runda 1C - https://sio2.mimuw.edu.pl/c/pa-2025-1/p/fin/ //-std=c++20 #include<iostream> #include <algorithm> #include <vector> #include <tuple> using namespace std; u_int32_t n; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n; bool finito = false; int i = 0; int j = 0; while (!finito) { i++; string s; int x; cin >> s >> x; if ((s == "TAK") && ((j < 10) || (x < 2))) { j++; cout << i << ' '; } finito = (j == 20 || i == n); if (j > 20) { throw std::runtime_error("j>20"); } } //for (; i < n; i++) { // todo sprawdz czy trzeba wczytac cale wejscie // string s; // int x; // cin >> s >> x; //} } |