-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathC.cpp
40 lines (36 loc) · 765 Bytes
/
C.cpp
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
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <algorithm>
using namespace std;
void hacked_exam(int N, int Q, vector<int>& S, vector<string>& A) {
for (int i = 0; i < N; i++) {
if (2 * S[i] >= Q)
continue;
S[i] = Q - S[i];
for (int j = 0; j < Q; j++) {
if (A[i][j] == 'T')
A[i][j] = 'F';
else
A[i][j] = 'T';
}
}
int pos = distance(S.begin(), max_element(S.begin(), S.end()));
cout << A[pos] << " " << S[pos] << "/1" << endl;
}
int main() {
int T;
cin >> T;
for (int x = 1; x <= T; x++) {
int N, Q;
cin >> N >> Q;
vector<int> S(N);
vector<string> A(N);
for (int i = 0; i < N; i++)
cin >> A[i] >> S[i];
cout << "Case #" << x << ": ";
hacked_exam(N, Q, S, A);
}
return 0;
}