#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define FASTIO \
std::ios::sync_with_stdio(false); \
cin.tie(NULL);
#ifdef DEBUG
#define debug(x) cerr << #x << " = " << x << endl;
#else
#define debug(x)
#endif
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vs = vector<string>;
#define ifor(x) for (int i = 0; i < x; i++)
#define vcin(v, n) \
ifor(n) { \
int abc; \
cin >> abc; \
v.push_back(abc); \
}
void ld(int *container, int n) {
for (int i = 0; i < n; i++) {
cin >> *(container + i);
}
}
int main() {
FASTIO
int n, counter = 0;
cin >> n;
ifor(n) {
if (counter == 20)
break;
string s;
int x;
cin >> s;
cin >> x;
if (counter < 10 && s == "TAK") {
counter++;
cout << i + 1 << " ";
} else if (counter >= 10 && s == "TAK" && x < 2) {
counter++;
cout << i + 1 << " ";
}
}
cout << "\n";
}
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 | #include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define eb emplace_back #define FASTIO \ std::ios::sync_with_stdio(false); \ cin.tie(NULL); #ifdef DEBUG #define debug(x) cerr << #x << " = " << x << endl; #else #define debug(x) #endif using ll = long long; using ull = unsigned long long; using vi = vector<int>; using vs = vector<string>; #define ifor(x) for (int i = 0; i < x; i++) #define vcin(v, n) \ ifor(n) { \ int abc; \ cin >> abc; \ v.push_back(abc); \ } void ld(int *container, int n) { for (int i = 0; i < n; i++) { cin >> *(container + i); } } int main() { FASTIO int n, counter = 0; cin >> n; ifor(n) { if (counter == 20) break; string s; int x; cin >> s; cin >> x; if (counter < 10 && s == "TAK") { counter++; cout << i + 1 << " "; } else if (counter >= 10 && s == "TAK" && x < 2) { counter++; cout << i + 1 << " "; } } cout << "\n"; } |
English