結果
問題 | No.2209 Flip and Reverse |
ユーザー |
![]() |
提出日時 | 2023-02-10 21:31:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 50 ms / 2,000 ms |
コード長 | 499 bytes |
コンパイル時間 | 574 ms |
コンパイル使用メモリ | 69,772 KB |
実行使用メモリ | 7,184 KB |
最終ジャッジ日時 | 2024-07-07 15:42:01 |
合計ジャッジ時間 | 3,085 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <iostream>#include <vector>#include <string>#include <algorithm>using namespace std;int main(){int n; cin >> n;string s, t;cin >> s;cin >> t;int cnt1 = 0, cnt2 = 0;for(int i = 0; i < n; i++){if(s[i] != t[i]) cnt1++;}for(int i = 0; i < n; i++){if(s[i] != t[n-i-1]) cnt2++;}int ans = 1 << 30;if(cnt1%2 == 0) ans = min(ans, cnt1);if(cnt2%2 == 1) ans = min(ans, cnt2);cout << ans << endl;return 0;}