結果

問題 No.2240 WAC
ユーザー rabimea
提出日時 2023-03-10 21:27:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 416 bytes
コンパイル時間 1,541 ms
コンパイル使用メモリ 193,420 KB
最終ジャッジ日時 2025-02-11 07:40:35
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 37 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	ios::sync_with_stdio(0);
	
	int n, m; cin >> n >> m;
	
	string s; cin >> s;
	
	int l = m, r = n;
	int sum = 0;
	
	bool f = 1;
	for(char c : s) {
		if(c == 'W')
			sum ++;
		else if(c == 'C')
			sum --;
		else {
			if(l) {
				l --;
				sum ++;
			} else {
				r --;
				sum --;
			}
		}
		if(sum < 0)
			f = 0;
	}
	
	cout << (f ? "Yes" : "No") << '\n';
}
0