結果

問題 No.1183 コイン遊び
ユーザー risujirohrisujiroh
提出日時 2020-08-22 13:02:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 3,653 ms
コンパイル使用メモリ 254,884 KB
実行使用メモリ 23,344 KB
最終ジャッジ日時 2024-04-23 07:13:51
合計ジャッジ時間 8,078 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,248 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 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 4 ms
5,376 KB
testcase_11 AC 10 ms
5,376 KB
testcase_12 AC 81 ms
14,824 KB
testcase_13 AC 76 ms
14,040 KB
testcase_14 AC 127 ms
18,480 KB
testcase_15 AC 135 ms
19,364 KB
testcase_16 AC 128 ms
19,248 KB
testcase_17 AC 133 ms
19,380 KB
testcase_18 AC 129 ms
19,248 KB
testcase_19 AC 129 ms
19,252 KB
testcase_20 AC 131 ms
19,248 KB
testcase_21 AC 117 ms
15,052 KB
testcase_22 AC 110 ms
15,048 KB
testcase_23 AC 109 ms
14,924 KB
testcase_24 AC 108 ms
15,104 KB
testcase_25 AC 127 ms
19,248 KB
testcase_26 AC 131 ms
19,376 KB
testcase_27 AC 136 ms
19,248 KB
testcase_28 AC 131 ms
19,248 KB
testcase_29 AC 112 ms
15,104 KB
testcase_30 AC 117 ms
23,344 KB
testcase_31 AC 140 ms
19,380 KB
testcase_32 AC 136 ms
19,248 KB
testcase_33 AC 134 ms
19,244 KB
testcase_34 AC 131 ms
19,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/extc++.h>

#ifndef DUMP
#define DUMP(...) (void)0
#endif

using namespace std;

template <class S>
auto rle(const S& s) {
  vector<pair<typename S::value_type, int>> res;
  for (auto c : s)
    if (empty(res) or res.back().first != c)
      res.emplace_back(c, 1);
    else
      ++res.back().second;
  return res;
}

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  for (auto&& e : a) cin >> e;
  for (auto&& e : b) cin >> e;
  for (int i = 0; i < n; ++i) c[i] = a[i] != b[i];
  int res = 0;
  for (auto [x, y] : rle(c))
    if (x) ++res;
  cout << res << '\n';
}
0