結果

問題 No.1183 コイン遊び
ユーザー nono
提出日時 2020-10-27 16:45:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 322 ms / 2,000 ms
コード長 642 bytes
コンパイル時間 1,757 ms
コンパイル使用メモリ 168,016 KB
実行使用メモリ 15,104 KB
最終ジャッジ日時 2024-07-21 21:57:21
合計ジャッジ時間 10,619 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1001001;

int main(void) {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  for(int i = 0; i < n; i++) cin >> b[i];

  vector<int> c(n);
  int ans = 0;
  for(int i = 0; i < n; i++) {
    c[i] = (a[i] + b[i])%2;
  }
  for(int i = 0; i < n; i++){
    if(c[i] == 1) {
      for(int j = i; j < n; j++) {
        if(c[j] == 0 || j == n-1) {
          i = j;
          break;
        }
      }
      ans++;
    }
  }
  cout<<ans<<endl;

  return 0;
}
0