結果

問題 No.1183 コイン遊び
ユーザー aspi
提出日時 2020-08-17 00:34:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 322 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 68,820 KB
実行使用メモリ 5,504 KB
最終ジャッジ日時 2024-10-11 10:47:09
合計ジャッジ時間 10,442 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int N,ans=0,count=0;
    cin>>N;
    bool A[1000004],B[1000004];//配列A,B
    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++){
        if(A[i]^B[i]){//A[i]!=B[i]でもOK
            count++;
        }
        else if(count>0){
            ans++;
            count=0;
        }
    }
    if(count>0){
        ans++;
    }
    cout<<ans<<endl;
}
0