-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathB1058.cpp
72 lines (69 loc) · 1.44 KB
/
B1058.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN = 1010, MAXM = 110;
int N, M;
int stu[MAXN] = {0};
struct Question{
int id, score, num, ansNum, ans[6], wrongNum;
} ques[MAXM];
bool cmp(const Question &q1, const Question &q2){
if(q1.wrongNum != q2.wrongNum) return q1.wrongNum > q2.wrongNum;
else return q1.id < q2.id;
}
int main(){
scanf("%d%d", &N, &M);
for(int i = 0; i < M; ++i){
scanf("%d%d%d", &ques[i].score, &ques[i].num, &ques[i].ansNum);
for(int j = 0; j < ques[i].ansNum; ++j){
char str[4];
scanf("%s", str);
ques[i].ans[j] = str[0] - 'a';
}
ques[i].id = i + 1;
ques[i].wrongNum = 0;
}
for(int i = 0; i < N; ++i){
for(int j = 0; j < M; ++j){
int ansNum = 0, ans[6];
char str[4];
scanf("%s", str);
ansNum = str[1] - '0';
for(int k = 0; k < ansNum; ++k){
scanf("%s", str);
ans[k] = str[0] - 'a';
}
bool flag = true;
if(ansNum != ques[j].ansNum){
flag = false;
}else{
for(int k = 0; k < ansNum; ++k){
if(ans[k] != ques[j].ans[k]){
flag = false;
}
}
}
if(flag == true){
stu[i] += ques[j].score;
}else{
++ques[j].wrongNum;
}
}
printf("%d\n", stu[i]);
}
sort(ques, ques+M, cmp);
if(ques[0].wrongNum == 0){
printf("Too simple");
}else{
int max = ques[0].wrongNum;
printf("%d", max);
for(int i = 0; i < M; ++i){
if(ques[i].wrongNum == max){
printf(" %d", ques[i].id);
}else{
break;
}
}
}
return 0;
}