結果

問題 No.2209 Flip and Reverse
ユーザー tsugutsugu
提出日時 2023-03-05 01:33:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 1,646 ms
コンパイル使用メモリ 166,636 KB
実行使用メモリ 5,720 KB
最終ジャッジ日時 2024-09-18 01:27:07
合計ジャッジ時間 3,667 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    string s, t;
    cin >> n >> s >> t;
    for (int i = 0; i < 2; i++) {
        int cnt = 0;
        for (int j = 0; j < n; j++) {
            if (s[j] != t[j]) {
                cnt++;
            }
        }
        if (cnt % 2 == i) {
            cout << cnt << '\n';
            return 0;
        }
        reverse(s.begin(), s.end());
    }
}
0