5457 | 2023-06-22 13:36:32 | TuruTamas | Gyros (30) | cpp17 | Forditási hiba |
int main() {
// string path;
// cin >> path;
// auto f = ifstream(path);
int T;
cin >> T;
for (int i = 0; i < T; i++) {
int N, csikke, boci, V, C, B;
V = C = B = 0;
cin >> N >> csikke >> boci;
for (int k = 0; k < N; k++) {
char c;
cin >> c;
if (c == 'C')
C++;
else if (c == 'B')
B++;
else if (c == 'V')
V++;
}
int vegyes_max = min({csikke, boci, V});
int csirke_max = min(csikke/2, C);
int boci_max = min(boci/2, B);
bool f = false;
int l = -69420;
int i2 = 0;
for (int j = 0; j < vegyes_max; ++j) {
int val = j + min((csikke-j)/2, C) + min((boci-j)/2, B);
if (val <= l)
break;
l = val;
i2 = j;
}
// cout << "DEBUG: " << i2 << ' ' << vegyes_max << ' ' << C << ' ' << B << ' ' <<
// i2 + min((csikke-i2)/2, C) + min((boci-i2)/2, B) << ' ' << vegyes_max + min((csikke-vegyes_max)/2, C) + min((boci-vegyes_max)/2, B) << "\n";
cout << max(
i2 + min((csikke-i2)/2, C) + min((boci-i2)/2, B),
vegyes_max + min((csikke-vegyes_max)/2, C) + min((boci-vegyes_max)/2, B)
);
cout << "\n";
}
}
exit status 1
main.cpp: In function 'int main()':
main.cpp:7:5: error: 'cin' was not declared in this scope
7 | cin >> T;
| ^~~
main.cpp:22:26: error: 'min' was not declared in this scope; did you mean 'main'?
22 | int vegyes_max = min({csikke, boci, V});
| ^~~
| main
main.cpp:37:9: error: 'cout' was not declared in this scope
37 | cout << max(
| ^~~~
main.cpp:37:17: error: 'max' was not declared in this scope
37 | cout << max(
| ^~~
Exited with error status 1