結果

問題 No.1183 コイン遊び
ユーザー forest3forest3
提出日時 2020-12-03 22:13:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 291 ms / 2,000 ms
コード長 568 bytes
コンパイル時間 2,037 ms
コンパイル使用メモリ 166,956 KB
実行使用メモリ 11,112 KB
最終ジャッジ日時 2023-10-12 08:30:53
合計ジャッジ時間 12,697 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,356 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 7 ms
4,348 KB
testcase_11 AC 19 ms
4,348 KB
testcase_12 AC 180 ms
7,932 KB
testcase_13 AC 161 ms
7,332 KB
testcase_14 AC 267 ms
10,360 KB
testcase_15 AC 286 ms
11,112 KB
testcase_16 AC 287 ms
10,840 KB
testcase_17 AC 286 ms
10,892 KB
testcase_18 AC 287 ms
10,880 KB
testcase_19 AC 288 ms
10,956 KB
testcase_20 AC 287 ms
10,972 KB
testcase_21 AC 271 ms
10,880 KB
testcase_22 AC 273 ms
10,964 KB
testcase_23 AC 287 ms
10,912 KB
testcase_24 AC 285 ms
10,912 KB
testcase_25 AC 286 ms
10,892 KB
testcase_26 AC 287 ms
10,908 KB
testcase_27 AC 288 ms
10,976 KB
testcase_28 AC 290 ms
10,776 KB
testcase_29 AC 269 ms
10,892 KB
testcase_30 AC 280 ms
10,904 KB
testcase_31 AC 285 ms
10,956 KB
testcase_32 AC 286 ms
10,776 KB
testcase_33 AC 291 ms
10,820 KB
testcase_34 AC 285 ms
10,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> A( N );
	for( int i = 0; i < N; i++ ) {
		cin >> A[i];
	}
	vector<int> B( N );
	for( int i = 0; i < N; i++ ) {
		cin >> B[i];
	}

	int ans = 0;
	int same = -1;
	for( int i = 0; i < N; i++ ) {
		if( same < 0 ) {
			if( A[i] == B[i] ) same = 1;
			else same = 0;
		}
		else if( same ) {
			if( A[i] == B[i] ) same = 1;
			else same = 0;
		}
		else {
			if( A[i] == B[i] ) {
				ans++;
				same = 1;
			}
			else same = 0;
		}
	}
	if( same == 0 ) ans++;

	cout << ans << endl;
}
0