結果

問題 No.1183 コイン遊び
ユーザー yorry2101yorry2101
提出日時 2023-06-22 14:44:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 288 ms / 2,000 ms
コード長 566 bytes
コンパイル時間 910 ms
コンパイル使用メモリ 73,808 KB
実行使用メモリ 11,104 KB
最終ジャッジ日時 2023-09-12 09:12:40
合計ジャッジ時間 10,379 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 8 ms
4,376 KB
testcase_11 AC 19 ms
4,376 KB
testcase_12 AC 179 ms
7,788 KB
testcase_13 AC 160 ms
7,396 KB
testcase_14 AC 266 ms
10,264 KB
testcase_15 AC 286 ms
10,964 KB
testcase_16 AC 285 ms
10,896 KB
testcase_17 AC 287 ms
10,836 KB
testcase_18 AC 286 ms
10,796 KB
testcase_19 AC 285 ms
10,800 KB
testcase_20 AC 288 ms
10,760 KB
testcase_21 AC 268 ms
10,768 KB
testcase_22 AC 269 ms
10,840 KB
testcase_23 AC 286 ms
10,768 KB
testcase_24 AC 286 ms
10,780 KB
testcase_25 AC 285 ms
10,852 KB
testcase_26 AC 285 ms
10,752 KB
testcase_27 AC 286 ms
10,904 KB
testcase_28 AC 287 ms
10,772 KB
testcase_29 AC 267 ms
11,104 KB
testcase_30 AC 277 ms
10,764 KB
testcase_31 AC 284 ms
10,880 KB
testcase_32 AC 284 ms
10,752 KB
testcase_33 AC 285 ms
10,804 KB
testcase_34 AC 285 ms
10,912 KB
権限があれば一括ダウンロードができます

ソースコード

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 = (a[0] != b[0]);
    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