結果
問題 | No.2209 Flip and Reverse |
ユーザー |
![]() |
提出日時 | 2023-02-10 21:22:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 494 bytes |
コンパイル時間 | 1,522 ms |
コンパイル使用メモリ | 168,328 KB |
実行使用メモリ | 7,180 KB |
最終ジャッジ日時 | 2024-07-07 15:30:09 |
合計ジャッジ時間 | 3,941 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>using namespace std;const int INF = 10000000;int main(){int N;cin >> N;string S;cin >> S;string T;cin >> T;int cnt1 = 0;for (int i = 0; i < N; i++){if (S[i] != T[i]){cnt1++;}}int cnt2 = 0;for (int i = 0; i < N; i++){if (S[i] != T[N - 1 - i]){cnt2++;}}int ans = INF;if (cnt1 % 2 == 0){ans = min(ans, cnt1);}if (cnt2 % 2 == 1){ans = min(ans, cnt2);}cout << ans << endl;}