結果
問題 | No.2240 WAC |
ユーザー |
|
提出日時 | 2023-03-10 21:38:39 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,545 bytes |
コンパイル時間 | 9,778 ms |
コンパイル使用メモリ | 277,092 KB |
最終ジャッジ日時 | 2025-02-11 07:56:00 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 WA * 8 |
ソースコード
#ifdef LOCAL#include <local.hpp>#else#pragma GCC optimize("O3,unroll-loops")#pragma GCC target("avx2")#include <bits/stdc++.h>#define debug(...) (static_cast<void>(0))#define postprocess() (static_cast<void>(0))#endif// #include "atcoder/dsu.hpp"// #include "atcoder/modint.hpp"// using mint = atcoder::modint998244353;// using mint = atcoder::modint1000000007;using namespace std;using ll = long long;using ld = long double;void solve([[maybe_unused]] int test) {ll N, M;cin >> N >> M;string S;cin >> S;int ac = 0;for (int i = 0; i < (int)S.size(); i++) {if (S[i] == 'A') {ac++;}if (S[i] == 'C') {if (ac <= 0) {cout << "No" << endl;return;}ac--;}}vector<char> S2;int cnt_a = 0;for (int i = 0; i < (int)S.size(); i++) {switch (S[i]) {case 'A':if (cnt_a < M) {cnt_a++;continue;}S2.push_back('A');break;case 'C':break;case 'W':S2.push_back('W');break;}}reverse(S2.begin(), S2.end());cout << (is_sorted(S2.begin(), S2.end()) ? "Yes" : "No") << endl;}int main() {ios::sync_with_stdio(false), cin.tie(nullptr);int t = 1;// cin >> t;for (int _t = 1; _t <= t; _t++) solve(_t);postprocess();}