結果

問題 No.1183 コイン遊び
ユーザー 👑 zeronosu77108zeronosu77108
提出日時 2020-08-22 13:15:14
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 1,175 bytes
コンパイル時間 1,207 ms
コンパイル使用メモリ 141,216 KB
実行使用メモリ 20,532 KB
最終ジャッジ日時 2024-04-23 07:36:51
合計ジャッジ時間 5,494 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 4 ms
6,940 KB
testcase_11 AC 9 ms
6,940 KB
testcase_12 AC 78 ms
12,260 KB
testcase_13 AC 71 ms
12,132 KB
testcase_14 AC 116 ms
15,476 KB
testcase_15 AC 123 ms
15,336 KB
testcase_16 AC 122 ms
15,344 KB
testcase_17 AC 123 ms
15,852 KB
testcase_18 AC 125 ms
16,368 KB
testcase_19 AC 125 ms
15,344 KB
testcase_20 AC 124 ms
16,880 KB
testcase_21 AC 109 ms
10,992 KB
testcase_22 AC 102 ms
11,048 KB
testcase_23 AC 103 ms
10,936 KB
testcase_24 AC 104 ms
10,960 KB
testcase_25 AC 127 ms
15,988 KB
testcase_26 AC 126 ms
16,368 KB
testcase_27 AC 128 ms
16,628 KB
testcase_28 AC 124 ms
16,496 KB
testcase_29 AC 107 ms
10,896 KB
testcase_30 AC 108 ms
20,532 KB
testcase_31 AC 123 ms
15,984 KB
testcase_32 AC 125 ms
16,108 KB
testcase_33 AC 126 ms
16,368 KB
testcase_34 AC 127 ms
15,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;\
template <class T1, class T2>ostream &operator<<(ostream &o,const pair<T1,T2>&p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;
using P = pair<int,int>;

int main() {
    int n;
    cin >> n;
    vector a(n,0);
    for (int i=0; i<n; i++) cin >> a[i];
    vector b(n,0);
    for (int i=0; i<n; i++) cin >> b[i];

    vector<P> len;
    len.emplace_back(a[0]==b[0], 0);
    for (int i=0; i<n; i++) {
        if ((a[i] == b[i]) == len.back().first) len.back().second++;
        else len.emplace_back(a[i]==b[i],1);
    }

    int ans = 0;
    for (auto [a,b] : len) {
        if (!a) ans++;
    }

    cout << ans << endl;
}
0