結果

問題 No.1183 コイン遊び
ユーザー ffffff
提出日時 2020-08-22 13:53:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 284 ms / 2,000 ms
コード長 1,957 bytes
コンパイル時間 810 ms
コンパイル使用メモリ 92,316 KB
実行使用メモリ 15,372 KB
最終ジャッジ日時 2024-04-23 08:18:49
合計ジャッジ時間 8,354 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,748 KB
testcase_01 AC 2 ms
7,748 KB
testcase_02 AC 2 ms
7,624 KB
testcase_03 AC 2 ms
7,748 KB
testcase_04 AC 3 ms
7,752 KB
testcase_05 AC 2 ms
7,752 KB
testcase_06 AC 2 ms
7,752 KB
testcase_07 AC 2 ms
7,748 KB
testcase_08 AC 3 ms
7,752 KB
testcase_09 AC 3 ms
7,620 KB
testcase_10 AC 8 ms
7,752 KB
testcase_11 AC 19 ms
7,884 KB
testcase_12 AC 170 ms
14,120 KB
testcase_13 AC 160 ms
14,324 KB
testcase_14 AC 261 ms
15,052 KB
testcase_15 AC 273 ms
15,308 KB
testcase_16 AC 272 ms
15,372 KB
testcase_17 AC 281 ms
15,308 KB
testcase_18 AC 284 ms
15,308 KB
testcase_19 AC 277 ms
15,184 KB
testcase_20 AC 277 ms
15,372 KB
testcase_21 AC 262 ms
15,372 KB
testcase_22 AC 265 ms
15,244 KB
testcase_23 AC 278 ms
15,244 KB
testcase_24 AC 272 ms
15,372 KB
testcase_25 AC 273 ms
15,244 KB
testcase_26 AC 270 ms
15,244 KB
testcase_27 AC 277 ms
15,372 KB
testcase_28 AC 276 ms
15,368 KB
testcase_29 AC 262 ms
15,372 KB
testcase_30 AC 272 ms
15,372 KB
testcase_31 AC 277 ms
15,244 KB
testcase_32 AC 271 ms
15,244 KB
testcase_33 AC 272 ms
15,244 KB
testcase_34 AC 276 ms
15,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<algorithm>
#include<bitset>
#include<iostream>
#include<iomanip>
#include<set>
#include<string>
#include<math.h>
#include<stack>
#include<string>
#include<queue>
#include<vector>
using namespace std;
typedef long long int ll;
typedef pair<int, ll> P;

//--------------
///#define DEBUG
//--------------

#ifdef DEBUG
	#define debugprint(x) cout<<x<<" "
	#define debugendl cout<<endl
	#define debug(x) x
#else
	#define debugprint(x)
	#define debugendl
	#define debug(x)
#endif

class zahyo{
	public:
	int x;
	int y;
	zahyo(){
		x=0;
		y=0;
	}
	zahyo(int x_,int y_){
		x=x_;
		y=y_;
	}
	void print(){
		cout<<x<<" "<<y;
	}
	zahyo operator+(zahyo add){
		add.x=this->x+add.x;
		add.y=this->y+add.y;
		return add;
	}
	zahyo operator-(zahyo add){
		add.x=this->x-add.x;
		add.y=this->y-add.y;
		return add;
	}
	zahyo operator*(int t){
		zahyo temp;
		temp.x=this->x*t;
		temp.y=this->y*t;
		return temp;
	}
	zahyo operator%(int t){
		zahyo temp(this->x%t,this->y%t);
		return temp;
	}
	zahyo operator/(int t){
		zahyo temp(this->x/t,this->y/t);
		return temp;
	}
	bool operator==(const zahyo add) const{
		if(add.x==this->x and add.y==this->y){return true;}
		else{return false;}
	}
	bool operator!=(const zahyo add) const{
		if(add.x==this->x or add.y==this->y){return false;}
		else{return true;}
	}
	bool operator<(const zahyo add) const{
		if(this->x<add.x){return true;}
		else if(this->x==add.x and this->y<add.y){return true;}
		else{return false;}
	}
	bool operator>(const zahyo add) const{
		if(this->x>add.x){return true;}
		else if(this->x==add.x and this->y>add.y){return true;}
		else{return false;}
	}
	void input(){
		cin>>x>>y;
	}
};

int a[1000000];
int b[1000000];
int c[1000000];

int main(){
	int n;cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int j=0;j<n;j++){
		cin>>b[j];
		c[j]=a[j] xor b[j];
	}
	int ans=0;
	if(c[0]==1){
		ans++;
	}
	for(int i=1;i<n;i++){
		if(c[i]!=c[i-1]){
			ans++;
		}
	}
	cout<<ans/2+ans%2<<endl;
}
0