結果

問題 No.2209 Flip and Reverse
ユーザー tnakao0123tnakao0123
提出日時 2023-04-23 00:00:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 611 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 43,088 KB
実行使用メモリ 5,760 KB
最終ジャッジ日時 2024-04-25 01:22:32
合計ジャッジ時間 3,226 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 12 ms
5,632 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 21 ms
5,760 KB
testcase_15 AC 20 ms
5,632 KB
testcase_16 AC 21 ms
5,504 KB
testcase_17 AC 21 ms
5,760 KB
testcase_18 AC 21 ms
5,504 KB
testcase_19 AC 21 ms
5,760 KB
testcase_20 AC 21 ms
5,632 KB
testcase_21 AC 20 ms
5,632 KB
testcase_22 AC 21 ms
5,632 KB
testcase_23 AC 20 ms
5,760 KB
testcase_24 AC 18 ms
5,504 KB
testcase_25 AC 18 ms
5,632 KB
testcase_26 AC 18 ms
5,760 KB
testcase_27 AC 19 ms
5,504 KB
testcase_28 AC 13 ms
5,632 KB
testcase_29 AC 13 ms
5,760 KB
testcase_30 AC 13 ms
5,632 KB
testcase_31 AC 13 ms
5,760 KB
testcase_32 AC 13 ms
5,632 KB
testcase_33 AC 12 ms
5,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2209.cc:  No.2209 Flip and Reverse - yukicoder
 */

#include<cstdio>
#include<algorithm>

using namespace std;

/* constant */

const int MAX_N = 1000000;

/* typedef */

/* global variables */

char s[MAX_N + 4], t[MAX_N + 4];

/* subroutines */

int cntdiff(int n, char s[], char t[]) {
  int cnt = 0;
  for (int i = 0; i < n; i++)
    if (s[i] != t[i]) cnt++;
  return cnt;
}

/* main */

int main() {
  int n;
  scanf("%d%s%s", &n, s, t);

  int c0 = cntdiff(n, s, t);
  reverse(s, s + n);
  int c1 = cntdiff(n, s, t);

  printf("%d\n", (! (c0 & 1)) ? c0 : c1);
  return 0;
}
0