No.3010 Cyan Coder
タグ : / 解いたユーザー数 302
作問者 :
ゆにたりー卿
/ テスター :
👑
Rice_tawara459
Problem Statement
A programming contest with $N$ participants was held, and $M$ problems were set.
For each $i\ (1\leq i \leq N)$, you are given a string $S_i$ representing which problems participant $i$ solved correctly. $S_i$ is a string of length $M$ consisting of o,x. If the $j$-th character of $S_i$ is o, participant $i$ solved problem $j$ correctly; if it is x, the participant failed to solve it correctly.
Also, participant $i$ has a numerical value $R_i$ called their rating.
Now, all participants were shown the following taunting image.
Taunting image (collapsed)
As a result of being shown the taunting image, for each $i\ (1\leq i \leq N)$, participant $i$ faints if and only if both of the following conditions are satisfied.
- $R_i \geq 1200$.
- The participant failed to solve at least $1$ of problems $1,\ 2,\ 3,\ 4$.
Constraints
- $1 \leq N \leq 2 \times 10^5$
- $4 \leq M \leq 10$
- $0 \leq R_i \leq 5000$
- $S_i$ is a string of length $M$ consisting of
ox
Input
The input is given from standard input in the following format.
$N\ M$ $S_1\ R_1$ $\vdots$ $S_N\ R_N$
Output
Output the total number of participants who fainted.
Sample
Sample 1
Input
4 7 xxooooo 1000 oooooxo 1400 oooxxox 1300 ooxoxxx 1200
Output
2
Participant $1$ did not solve problems $1$ and $2$, but does not faint because their rating is less than $1200$.
Participant $2$ has a rating of at least $1200$, but does not faint because they solved all of problems $1,\ 2,\ 3,\ 4$.
Participant $3$ did not solve problem $1$ and has a rating of at least $1200$, so they faint.
Participant $4$ did not solve problem $3$ and has a rating of at least $1200$, so they faint.
In the end, $2$ of the participants fainted.
Sample 2
Input
3 5 oooox 1500 ooxxo 1100 xxxxx 800
Output
0
None of the participants faint.
Sample 3
Input
8 10 ooooooxxxx 1500 oooxoxoxox 1600 xxoxxxxxxx 400 ooooxxxxxx 600 oooooooooo 2300 xoxxxoxoxo 1200 oooxoxoxox 1300 ooooxxxxxx 400
Output
3
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。