結果
| 問題 |
No.2240 WAC
|
| コンテスト | |
| ユーザー |
GlinTFraulein
|
| 提出日時 | 2023-03-10 23:11:11 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 2,000 ms |
| コード長 | 1,071 bytes |
| コンパイル時間 | 4,426 ms |
| コンパイル使用メモリ | 252,672 KB |
| 最終ジャッジ日時 | 2025-02-11 09:12:26 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:47:25: warning: ignoring return value of ‘std::vector<bool, _Alloc>::reference std::vector<bool, _Alloc>::operator[](size_type) [with _Alloc = std::allocator<bool>; reference = std::vector<bool>::reference; size_type = long unsigned int]’, declared with attribute ‘nodiscard’ [-Wunused-result]
47 | used[posa.back()];
| ^
In file included from /usr/include/c++/13/vector:67,
from /usr/include/c++/13/functional:64,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53,
from main.cpp:1:
/usr/include/c++/13/bits/stl_bvector.h:1086:7: note: declared here
1086 | operator[](size_type __n)
| ^~~~~~~~
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
#define elif else if
#define ll long long
#define vll vector<long long>
#define vec vector
#define embk emplace_back
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep3(i, n, k) for (int i = k; i < n; i++)
#define all(a) a.begin(), a.end()
using namespace std;
using namespace atcoder;
const ll INF = 1LL << 60;
const ll mod = 998244353;
int main() {
ll n, m; cin >> n >> m;
string s; cin >> s;
ll ss = s.size();
vec<bool> used(ss);
deque<ll> posa;
ll count = 0;
rep(i, ss) {
if (s[ss-i-1] == 'A') {
count++;
posa.push_back(ss-i-1);
}
elif (s[ss-i-1] == 'W') {
count--;
if (count < 0) {
cout << "No" << endl;
return 0;
}
used[posa.front()] = 1;
posa.pop_front();
}
}
rep(i, ss) {
if (s[i] == 'C') {
if (posa.back() < i) {
used[posa.back()];
posa.pop_back();
}
else {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
}
GlinTFraulein