結果

問題 No.2209 Flip and Reverse
ユーザー CoCo_Japan_panCoCo_Japan_pan
提出日時 2023-02-10 21:42:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 874 bytes
コンパイル時間 2,138 ms
コンパイル使用メモリ 199,068 KB
実行使用メモリ 6,352 KB
最終ジャッジ日時 2023-09-21 22:48:51
合計ジャッジ時間 4,250 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 19 ms
6,064 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 19 ms
6,096 KB
testcase_19 AC 19 ms
6,156 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 19 ms
6,024 KB
testcase_24 AC 16 ms
6,088 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 10 ms
6,040 KB
testcase_29 AC 10 ms
6,088 KB
testcase_30 AC 10 ms
6,104 KB
testcase_31 WA -
testcase_32 AC 9 ms
6,168 KB
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(n) for(ll _ = 0; _ < (n); ++_)
#define rep2(i, n) for(ll i = 0; i < (n); ++i)
#define rep3(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__)

#define all(x) (x).begin(), (x).end()
template <class T> using vec = vector<T>;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    string S, T;
    cin >> S >> T;
    string S_rev = S;
    reverse_copy(all(S), S_rev.begin());
    // cout << S << "\n" << S_rev << "\n";
    int cnt = 0, revcnt = 0;
    rep(i, N){
        if(T[i] != S[i]) ++cnt;
        if(T[i] != S_rev[i]) ++revcnt;
    }
    if(cnt % 2 == 1) ++cnt;
    if(revcnt % 2 == 0) ++revcnt;
    cout << min(cnt, revcnt) << "\n";
} 
0