結果
問題 |
No.2209 Flip and Reverse
|
ユーザー |
|
提出日時 | 2024-03-15 03:24:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 571 bytes |
コンパイル時間 | 1,591 ms |
コンパイル使用メモリ | 167,624 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-29 23:56:55 |
合計ジャッジ時間 | 3,945 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define sz(a) (int)(a.size()) #define debug(x) cout << "> " << (#x) << " = " << x << endl; #define all(a) (a).begin(), (a).end() int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; string s, t; cin >> s >> t; int cnt1 = 0, cnt2 = 0; int bal = 0; for (int i = 0; i < n; i++) { if (s[i] != t[i]) { cnt1++; bal ^= 1; } if (s[i] != t[n - i - 1]) { cnt2++; } } if (!bal) cout << cnt1 << "\n"; else cout << cnt2 << "\n"; }