結果

問題 No.1183 コイン遊び
ユーザー iqueue02
提出日時 2020-08-22 14:16:16
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 609 ms / 2,000 ms
コード長 593 bytes
コンパイル時間 2,330 ms
コンパイル使用メモリ 195,508 KB
最終ジャッジ日時 2025-01-13 08:34:36
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int INF = 1e9;

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  int res = 0;
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i], a[i] ^= b[i];
  vector<int> v;
  a.emplace_back(10);

  int prev = 0;
  for (int i = 0; i <= n; i++) {
    if (a[i] != a[prev]) {
      v.emplace_back(a[prev]);
      prev = i;
    }
  }

  for (auto e : v) res += e;

  cout << res << endl;
  return 0;
}
0