結果

問題 No.1183 コイン遊び
ユーザー IKyopro
提出日時 2020-08-22 13:20:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 3,800 ms
コンパイル使用メモリ 193,096 KB
最終ジャッジ日時 2025-01-13 07:28:07
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template <class T> using vvvec = vector<vvec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<int> A(N),B(N);
    for(auto& x:A) cin >> x;
    for(auto& x:B) cin >> x;
    int ans = 0;
    for(int l=0;l<N;l++){
        if(A[l]==B[l]) continue;
        int r = l+1;
        while(r<N && A[r]!=B[r]) r++;
        ans++;
        l = r-1;
    }
    cout << ans << "\n";
}
0