結果

問題 No.2209 Flip and Reverse
ユーザー 唐揚げが壊わ唐揚げが壊わ
提出日時 2023-02-22 01:51:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 914 bytes
コンパイル時間 2,233 ms
コンパイル使用メモリ 198,692 KB
実行使用メモリ 7,144 KB
最終ジャッジ日時 2023-09-29 13:58:15
合計ジャッジ時間 5,155 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 42 ms
6,868 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 55 ms
6,872 KB
testcase_15 AC 55 ms
6,912 KB
testcase_16 AC 56 ms
6,924 KB
testcase_17 AC 56 ms
6,872 KB
testcase_18 AC 55 ms
6,872 KB
testcase_19 AC 55 ms
6,856 KB
testcase_20 AC 56 ms
6,984 KB
testcase_21 AC 56 ms
6,928 KB
testcase_22 AC 56 ms
6,864 KB
testcase_23 AC 55 ms
6,916 KB
testcase_24 AC 50 ms
7,144 KB
testcase_25 AC 50 ms
6,856 KB
testcase_26 AC 49 ms
6,852 KB
testcase_27 AC 49 ms
6,876 KB
testcase_28 AC 42 ms
6,972 KB
testcase_29 AC 42 ms
6,872 KB
testcase_30 AC 42 ms
6,912 KB
testcase_31 AC 43 ms
6,876 KB
testcase_32 AC 41 ms
6,852 KB
testcase_33 AC 41 ms
6,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;
using vs = vector<string>;
#define lln \
  ll n;     \
  cin >> n;
#define REP(i, n) for (long long i = 0; i < n; i++)
#define REP2(i, s, e) for (long long i = s; i < e; i++)
#define UNIQUE_VECTOR(v) v.erase(unique(v.begin(), v.end()))
ll gcd(ll x, ll y) { return (x % y) ? gcd(y, x % y) : y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int main() {
  lln;
  string s, t;
  cin >> s >> t;
  ll cnt = 0;
  REP(i, n) {
    if (s[i] == '1') {
      cnt++;
    }
    if (t[i] == '1') {
      cnt--;
    }
  }
  if (cnt % 2) {
    reverse(t.begin(), t.end());
  } else {
  }
  ll ans = 0;
  REP(i, n) {
    if (s[i] != t[i]) {
      ans++;
    }
  }
  cout << ans << endl;
}

/*
0110111010
1001010011
@@@@@.@..@

0110111010
1100101001
@.@..@..@@
*/
0