結果
問題 |
No.2240 WAC
|
ユーザー |
|
提出日時 | 2023-03-10 23:41:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 936 bytes |
コンパイル時間 | 1,748 ms |
コンパイル使用メモリ | 191,784 KB |
最終ジャッジ日時 | 2025-02-11 09:21:48 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 43 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d%d", &n, &m); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%s", s); | ~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; const int N = 400010; char s[N]; int wa[N]; int ac[N]; int main() { int n, m; scanf("%d%d", &n, &m); scanf("%s", s); int all = n + n + m + m; int t = m; int *wi = wa, *ai = ac; char* send = s + all; for (char* p = s; s != send; p++) { if (*p == 'W') *(wi++) = 1; else if (*p == 'C') *(ai++) = -1; else if (t == 0) *(wi++) = -1; else { *(ai++) = 1; t--; } } bool ok = true; int* end = ac + m * 2; int* p = ac; int sum = 0; for (; p != end; p++) { sum += *p; ok &= sum >= 0; } end = wa + n * 2; p = wa; sum = 0; for (; p != end; p++) { sum += *p; ok &= sum >= 0; } if (ok) printf("Yes\n"); else printf("No\n"); return 0; }