結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 41 ms
6,824 KB
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 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 45 ms
7,132 KB
testcase_15 AC 45 ms
6,944 KB
testcase_16 AC 45 ms
6,948 KB
testcase_17 AC 45 ms
6,900 KB
testcase_18 AC 45 ms
6,888 KB
testcase_19 AC 44 ms
6,836 KB
testcase_20 AC 45 ms
6,904 KB
testcase_21 AC 45 ms
6,976 KB
testcase_22 AC 45 ms
6,948 KB
testcase_23 AC 45 ms
6,892 KB
testcase_24 AC 44 ms
6,976 KB
testcase_25 AC 44 ms
6,888 KB
testcase_26 AC 44 ms
6,844 KB
testcase_27 AC 44 ms
6,936 KB
testcase_28 AC 41 ms
6,928 KB
testcase_29 AC 41 ms
6,908 KB
testcase_30 AC 41 ms
6,840 KB
testcase_31 AC 42 ms
7,128 KB
testcase_32 AC 41 ms
6,900 KB
testcase_33 AC 40 ms
6,916 KB
権限があれば一括ダウンロードができます

ソースコード

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++;
    }
    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;
}
0