No.2240 WAC
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
Problem Statement
You are given a string $S$ consisting of $N$ Ws, $N+M$ As, and $M$ Cs.
Determine whether it is possible to obtain $N$ copies of WA and $M$ copies of AC
by repeating the following operation $N+M$ times.
Constraints
- $N,M$ are integers
- $1\le N,M\le 10^5$
-
$S$ is a string consisting of $N$
Ws, $N+M$As, and $M$Cs
Input
$N$ $M$ $S$
Output
If it is possible to obtain $N$ copies of WA and $M$ copies of AC
by repeating the operation $N+M$ times, print Yes; otherwise, print No.
Sample
Sample 1
Input
1 2 WAAACC
Output
Yes
Choosing $(i,j)=(4,6)$ in the $1$st operation yields AC,
choosing $(i,j)=(3,4)$ in the $2$nd operation yields AC,
and choosing $(i,j)=(1,2)$ in the $3$rd operation yields WA.
Sample 2
Input
2 2 ACWAWACA
Output
Yes
Sample 3
Input
2 3 WACAACACAW
Output
No
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
noya2
Nachia