結果
問題 | No.2629 A replace B replace C |
ユーザー |
|
提出日時 | 2024-02-16 21:29:31 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 756 bytes |
コンパイル時間 | 3,073 ms |
コンパイル使用メモリ | 245,176 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-09-28 19:44:18 |
合計ジャッジ時間 | 4,041 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 61 |
ソースコード
// #pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> // #include <x86intrin.h> using namespace std; #if __cplusplus >= 202002L using namespace numbers; #endif int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(ios::badbit | ios::failbit); int n; string s, t; cin >> n >> s >> t; array<int, 3> cnt{}; for(auto i = 0; i < n; ++ i){ if(s[i] == t[i]){ continue; } if(s[i] == 'A'){ ++ cnt[2 * (t[i] == 'C')]; } else if(s[i] == 'B'){ if(t[i] == 'A'){ cout << "No\n"; return 0; } ++ cnt[1]; } else{ cout << "No\n"; return 0; } } if(cnt[2]){ if(!cnt[1]){ cout << "No\n"; return 0; } cnt[2] = 0; } cnt[0] == cnt[1] ? cout << "Yes\n" : cout << "No\n"; return 0; } /* */