結果

問題 No.1183 コイン遊び
ユーザー akane
提出日時 2020-08-22 13:09:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 2,218 ms
コンパイル使用メモリ 194,348 KB
最終ジャッジ日時 2025-01-13 07:14:02
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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;

int main(){
    ios::sync_with_stdio(false);
    int N; cin>>N;
    vector<int> A(N),B(N);
    rep(i,N) cin>>A[i];
    rep(i,N) cin>>B[i];

    string flg="same"; // same or dif
    int ans = 0;
    rep(i,N){
        if(A[i]!=B[i]){
            flg = "dif";
        }else if(A[i]==B[i] && flg=="dif"){
            ans++;
            flg = "same";
        }

        if(i == N-1 && flg=="dif") ans++;
    }
    cout << ans << endl;
}
0