#include <iostream>
#include <string>
using namespace std;
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
unsigned n; // Liczba zawodników 20 <= n <= 10 000
cin >> n;
unsigned lista[20];
for(unsigned i = 0, j = 0; i < n; i++) {
string s; // Czy zawodnik chce uczestniczyć w finale; TAK/NIE
unsigned x; // Liczba startów w poprzednich finałach
cin >> s >> x;
if(s == "NIE") continue;
if(j < 10 || (j >= 10 && x < 2) ) lista[j++] = i+1;
if(j == 20) break;
}
for(unsigned i = 0; i < 20; i++) cout << lista[i] << ((i < 19) ? " " : "");
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 | #include <iostream> #include <string> using namespace std; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); unsigned n; // Liczba zawodników 20 <= n <= 10 000 cin >> n; unsigned lista[20]; for(unsigned i = 0, j = 0; i < n; i++) { string s; // Czy zawodnik chce uczestniczyć w finale; TAK/NIE unsigned x; // Liczba startów w poprzednich finałach cin >> s >> x; if(s == "NIE") continue; if(j < 10 || (j >= 10 && x < 2) ) lista[j++] = i+1; if(j == 20) break; } for(unsigned i = 0; i < 20; i++) cout << lista[i] << ((i < 19) ? " " : ""); return 0; } |
English