結果

問題 No.1183 コイン遊び
ユーザー maguromaguro
提出日時 2020-08-22 13:04:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 326 ms / 2,000 ms
コード長 1,392 bytes
コンパイル時間 2,542 ms
コンパイル使用メモリ 197,948 KB
実行使用メモリ 17,700 KB
最終ジャッジ日時 2024-04-23 07:16:41
合計ジャッジ時間 11,145 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 9 ms
6,944 KB
testcase_11 AC 22 ms
6,940 KB
testcase_12 AC 202 ms
13,068 KB
testcase_13 AC 179 ms
11,852 KB
testcase_14 AC 304 ms
15,980 KB
testcase_15 AC 325 ms
15,512 KB
testcase_16 AC 322 ms
17,272 KB
testcase_17 AC 323 ms
17,452 KB
testcase_18 AC 321 ms
16,608 KB
testcase_19 AC 320 ms
17,376 KB
testcase_20 AC 325 ms
17,700 KB
testcase_21 AC 306 ms
16,908 KB
testcase_22 AC 304 ms
16,224 KB
testcase_23 AC 323 ms
16,904 KB
testcase_24 AC 318 ms
15,892 KB
testcase_25 AC 322 ms
17,504 KB
testcase_26 AC 326 ms
16,644 KB
testcase_27 AC 322 ms
17,356 KB
testcase_28 AC 321 ms
15,540 KB
testcase_29 AC 302 ms
16,116 KB
testcase_30 AC 309 ms
15,764 KB
testcase_31 AC 319 ms
16,280 KB
testcase_32 AC 322 ms
17,100 KB
testcase_33 AC 320 ms
15,836 KB
testcase_34 AC 322 ms
17,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 2000000010;
constexpr ll INF= 2000000000000000000;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

ll mod(ll val, ll M) {
    ll res = val % M;
    if(res < 0) {
        res += M;
    }
    return res;
}

// N^P mod M(ただしM == -1の時はmodを取らない)
template<typename T>
T RS(T N, T P, T M){
    if(P == 0) {
        return 1;
    }
    if(P < 0) {
        return 0;
    }
    if(P % 2 == 0){
        ll t = RS(N, P/2, M);
        if(M == -1) return t * t;
        return t * t % M;
    }
    if(M == -1) {
        return N * RS(N,P - 1,M);
    }
    return N * RS(N, P-1, M) % M;
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0;i < N;i++) {
        cin >> A.at(i);
    }
    vector<int> B(N);
    for(int i = 0;i < N;i++) {
        cin >> B.at(i);
    }
    A.push_back(1);
    B.push_back(1);
    int ret = 0;
    for(int i = 0;i < N;i++) {
        if(A.at(i) != B.at(i) && A.at(i + 1) == B.at(i + 1)) {
            ret++;
        }
    }
    cout << ret << endl;
}
0