結果

問題 No.1183 コイン遊び
ユーザー mmn15277198
提出日時 2020-08-24 20:58:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 315 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 787 ms
コンパイル使用メモリ 94,108 KB
実行使用メモリ 11,196 KB
最終ジャッジ日時 2024-11-06 10:40:04
合計ジャッジ時間 9,459 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

int main(){
	
	long long n;
	cin >> n;
	
	vector<int> a(n),b(n);
	for(long long i=0;i<n;i++)cin >> a[i];
	for(long long i=0;i<n;i++)cin >> b[i];
	
	long long cnt=0;
	long long ans=0;
	
	for(long long i=0;i<n;i++){
		if(a[i]==b[i]){
			if(cnt>0){
				ans++;
			}
			cnt=0;
			continue;
		}else{
			cnt++;
		}
	}
	
	if(cnt>0)ans++;
	
	cout << ans << endl;
	
	return 0;
}
0