結果
問題 | No.2240 WAC |
ユーザー |
|
提出日時 | 2023-03-10 21:33:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 780 bytes |
コンパイル時間 | 1,770 ms |
コンパイル使用メモリ | 195,396 KB |
最終ジャッジ日時 | 2025-02-11 07:49:10 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 43 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main () {int N, M;cin >> N >> M;string s;cin >> s;int cc = 0;std::vector<int> V1, V2;for (int i = 0; i < (N + M) * 2; i ++) {if (s[i] == 'W') {V1.push_back(1);} else if (s[i] == 'C') {V2.push_back(-1);} else if (cc < M) {V2.push_back(1);cc ++;} else {V1.push_back(-1);}}int a = 0;for (auto x : V1) {a += x;if (a < 0) {cout << "No" << endl;return 0;}}for (auto x : V2) {a += x;if (a < 0) {cout << "No" << endl;return 0;}}cout << "Yes" << endl;}