結果

問題 No.2209 Flip and Reverse
ユーザー 👑 OnjoujiTokiOnjoujiToki
提出日時 2023-02-10 21:52:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,107 bytes
コンパイル時間 3,073 ms
コンパイル使用メモリ 128,884 KB
実行使用メモリ 6,224 KB
最終ジャッジ日時 2023-09-21 23:00:54
合計ジャッジ時間 3,597 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 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,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,504 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 27 ms
6,056 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 27 ms
6,116 KB
testcase_19 AC 27 ms
6,124 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 27 ms
6,160 KB
testcase_24 AC 18 ms
6,128 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 10 ms
6,068 KB
testcase_29 AC 10 ms
6,060 KB
testcase_30 AC 10 ms
6,144 KB
testcase_31 WA -
testcase_32 AC 10 ms
6,096 KB
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstring>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <unordered_map>
#include <unordered_set>

void solve() {
  int n;

  std::cin >> n;
  std::string s, t;
  std::cin >> s >> t;

  auto C = s;
  std::reverse(C.begin(), C.end());
  int ans1 = 0;
  int ans2 = 0;
  int c = 0, d = 0;

  // situation one
  int a = 0, b = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0' and t[i] == '1') {
      a += 1;
    } else if (s[i] == '1' and t[i] == '0') {
      b += 1;
    }
  }
  for (int i = 0; i < n; i++) {
    if (C[i] == '0' and t[i] == '1') {
      c += 1;
    } else if (C[i] == '1' and t[i] == '0') {
      d += 1;
    }
  }
  std::cout << std::min(a + b, c + d) << '\n';
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int t = 1;
  // std::cin >> t;

  while (t--) solve();
  return 0;
}
0