結果

問題 No.2209 Flip and Reverse
ユーザー Manuel1024Manuel1024
提出日時 2023-02-10 21:28:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 69,536 KB
実行使用メモリ 7,168 KB
最終ジャッジ日時 2023-09-21 22:31:50
合計ジャッジ時間 3,180 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 45 ms
6,928 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 45 ms
6,964 KB
testcase_19 AC 44 ms
6,932 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 45 ms
6,924 KB
testcase_24 AC 43 ms
6,856 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 41 ms
6,864 KB
testcase_29 AC 41 ms
6,996 KB
testcase_30 AC 41 ms
6,932 KB
testcase_31 WA -
testcase_32 AC 41 ms
6,980 KB
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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++;
    }
    cout << min(cnt1+cnt1%2, cnt2+(1-cnt2%2)) << endl;
    return 0;
}
0