結果

問題 No.1183 コイン遊び
ユーザー 👑 zeronosu77108zeronosu77108
提出日時 2020-08-22 13:15:14
言語 C++17(clang)
(14.0.0 + boost 1.83.0)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 1,175 bytes
コンパイル時間 2,348 ms
コンパイル使用メモリ 106,224 KB
実行使用メモリ 19,896 KB
最終ジャッジ日時 2023-08-05 10:04:35
合計ジャッジ時間 7,122 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 10 ms
4,376 KB
testcase_12 AC 91 ms
13,372 KB
testcase_13 AC 82 ms
12,656 KB
testcase_14 AC 132 ms
16,360 KB
testcase_15 AC 145 ms
15,744 KB
testcase_16 AC 137 ms
15,632 KB
testcase_17 AC 140 ms
15,608 KB
testcase_18 AC 138 ms
15,300 KB
testcase_19 AC 143 ms
15,808 KB
testcase_20 AC 138 ms
16,360 KB
testcase_21 AC 117 ms
10,820 KB
testcase_22 AC 116 ms
10,844 KB
testcase_23 AC 115 ms
10,848 KB
testcase_24 AC 114 ms
10,856 KB
testcase_25 AC 141 ms
16,632 KB
testcase_26 AC 143 ms
15,792 KB
testcase_27 AC 149 ms
15,544 KB
testcase_28 AC 142 ms
16,664 KB
testcase_29 AC 117 ms
10,864 KB
testcase_30 AC 123 ms
19,896 KB
testcase_31 AC 141 ms
15,264 KB
testcase_32 AC 140 ms
16,084 KB
testcase_33 AC 140 ms
15,808 KB
testcase_34 AC 140 ms
16,244 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