結果

問題 No.2209 Flip and Reverse
ユーザー SSRSSSRS
提出日時 2023-02-10 21:22:40
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 1,450 ms
コンパイル使用メモリ 165,332 KB
実行使用メモリ 7,172 KB
最終ジャッジ日時 2023-09-21 22:22:52
合計ジャッジ時間 3,923 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 40 ms
6,924 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 45 ms
6,852 KB
testcase_15 AC 45 ms
6,836 KB
testcase_16 AC 45 ms
6,868 KB
testcase_17 AC 45 ms
7,172 KB
testcase_18 AC 45 ms
6,836 KB
testcase_19 AC 45 ms
6,912 KB
testcase_20 AC 44 ms
6,932 KB
testcase_21 AC 44 ms
6,960 KB
testcase_22 AC 45 ms
6,920 KB
testcase_23 AC 44 ms
6,984 KB
testcase_24 AC 43 ms
6,972 KB
testcase_25 AC 44 ms
6,904 KB
testcase_26 AC 43 ms
6,900 KB
testcase_27 AC 44 ms
6,984 KB
testcase_28 AC 40 ms
6,868 KB
testcase_29 AC 41 ms
6,852 KB
testcase_30 AC 41 ms
7,160 KB
testcase_31 AC 41 ms
6,904 KB
testcase_32 AC 41 ms
6,948 KB
testcase_33 AC 40 ms
6,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int INF = 10000000;
int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  string T;
  cin >> T;
  int cnt1 = 0;
  for (int i = 0; i < N; i++){
    if (S[i] != T[i]){
      cnt1++;
    }
  }
  int cnt2 = 0;
  for (int i = 0; i < N; i++){
    if (S[i] != T[N - 1 - i]){
      cnt2++;
    }
  }
  int ans = INF;
  if (cnt1 % 2 == 0){
    ans = min(ans, cnt1);
  }
  if (cnt2 % 2 == 1){
    ans = min(ans, cnt2);
  }
  cout << ans << endl;
}
0