AmazonOA #121
Count Faults
估计简单可在线判题
考点(AI 标注)模拟/实现哈希计数
Observe each server's own requests separately; after three consecutive error results, replace the server and reset its consecutive error count to zero, and a success also resets it. Logs from other servers do not interrupt a server's consecutive requests.
输入格式
The first line contains n m; each of the next m lines contains a server number (1-based) and success/error. 1≤n≤200, 1≤m≤20000.
输出格式
Output a single integer answer.
样例 1
输入:
2 6
1 error
1 error
2 error
1 error
1 error
2 success
输出:
1
样例 2
输入:
1 6
1 error
1 error
1 error
1 error
1 error
1 error
输出:
2
样例 3
输入:
1 4
1 error
1 success
1 error
1 error
输出:
0
样例说明
Example 1: s1 is replaced once when its third error occurs, followed by only one more error, so the answer is 1. Example 2: six errors in a row cause a replacement every three, so the answer is 2. Example 3: a success interrupts the consecutive errors, so the answer is 0.