結果

問題 No.1183 コイン遊び
ユーザー nononono
提出日時 2020-10-27 16:45:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 291 ms / 2,000 ms
コード長 642 bytes
コンパイル時間 3,013 ms
コンパイル使用メモリ 164,512 KB
実行使用メモリ 14,968 KB
最終ジャッジ日時 2023-09-29 03:18:54
合計ジャッジ時間 10,286 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 7 ms
4,376 KB
testcase_11 AC 19 ms
4,376 KB
testcase_12 AC 182 ms
10,472 KB
testcase_13 AC 161 ms
9,872 KB
testcase_14 AC 271 ms
13,852 KB
testcase_15 AC 290 ms
14,836 KB
testcase_16 AC 290 ms
14,752 KB
testcase_17 AC 290 ms
14,712 KB
testcase_18 AC 291 ms
14,648 KB
testcase_19 AC 289 ms
14,820 KB
testcase_20 AC 291 ms
14,700 KB
testcase_21 AC 272 ms
14,708 KB
testcase_22 AC 274 ms
14,776 KB
testcase_23 AC 287 ms
14,764 KB
testcase_24 AC 289 ms
14,828 KB
testcase_25 AC 291 ms
14,764 KB
testcase_26 AC 290 ms
14,760 KB
testcase_27 AC 289 ms
14,644 KB
testcase_28 AC 289 ms
14,828 KB
testcase_29 AC 270 ms
14,700 KB
testcase_30 AC 284 ms
14,776 KB
testcase_31 AC 290 ms
14,968 KB
testcase_32 AC 288 ms
14,748 KB
testcase_33 AC 290 ms
14,948 KB
testcase_34 AC 291 ms
14,712 KB
権限があれば一括ダウンロードができます

ソースコード

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