結果

問題 No.2209 Flip and Reverse
ユーザー CoCo_Japan_panCoCo_Japan_pan
提出日時 2023-02-10 21:54:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 960 bytes
コンパイル時間 1,996 ms
コンパイル使用メモリ 198,472 KB
実行使用メモリ 7,336 KB
最終ジャッジ日時 2023-09-21 23:05:52
合計ジャッジ時間 4,032 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 19 ms
7,132 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 19 ms
7,188 KB
testcase_19 AC 18 ms
7,108 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 19 ms
7,152 KB
testcase_24 AC 17 ms
7,128 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 11 ms
7,188 KB
testcase_29 AC 10 ms
7,116 KB
testcase_30 AC 10 ms
7,112 KB
testcase_31 WA -
testcase_32 AC 11 ms
7,092 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, T_rev = T;
    reverse_copy(all(S), S_rev.begin());
    reverse_copy(all(T), T_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(T != T_rev){
        if(cnt % 2 == 1) ++cnt;
        if(revcnt % 2 == 0) ++revcnt;
    }
    cout << min(cnt, revcnt) << "\n";
} 
0