結果

問題 No.1183 コイン遊び
ユーザー DaYuanChi
提出日時 2021-04-01 20:41:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 327 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 2,115 ms
コンパイル使用メモリ 169,120 KB
実行使用メモリ 15,088 KB
最終ジャッジ日時 2024-12-20 03:11:35
合計ジャッジ時間 11,907 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
  int n; cin >> n;
  vector<int> a(n), b(n), c(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  for(int i = 0; i < n; i++) cin >> b[i];
  for(int i = 0; i < n; i++) c[i] = a[i]^b[i];
  int ans = 0;
  for(int i = 0; i < n-1; i++){
    if(c[i]==1 && c[i+1]==0) ans++;
  }
  if(c[n-1]==1) ans++;
  cout << ans << endl;
  return 0;
}
  
0