結果
問題 |
No.2629 A replace B replace C
|
ユーザー |
|
提出日時 | 2024-02-17 20:31:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 572 bytes |
コンパイル時間 | 1,925 ms |
コンパイル使用メモリ | 193,192 KB |
最終ジャッジ日時 | 2025-02-19 15:38:34 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 45 WA * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, ab = 0; string s, t; cin >> n >> s >> t; for(int i = 0; i < n; i++){ if(s[i] > t[i]){ cout << "No\n"; return 0; } if(s[i] == t[i]) continue; if(t[i] == 'C'){ if(ab == 0){ cout << "No\n"; return 0; } if(s[i] == 'B') ab--; }else{ ab++; } } cout << (ab == 0 ? "Yes" : "No") << '\n'; }