結果

問題 No.1183 コイン遊び
ユーザー yorry2101
提出日時 2023-06-22 14:41:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 556 bytes
コンパイル時間 683 ms
コンパイル使用メモリ 71,912 KB
最終ジャッジ日時 2025-02-15 00:08:15
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
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];
    }
    
    bool msrng = true;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == b[i] && msrng) {
            msrng = false;
            cnt++;
        }
        else if (a[i] != b[i] && !msrng) {
            msrng = true;
        }
    }
    if (msrng) cnt++;
    cout << cnt << endl;
}
0