結果

問題 No.110 しましまピラミッド
ユーザー pekempeypekempey
提出日時 2015-12-20 22:57:45
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 597 bytes
コンパイル時間 1,375 ms
コンパイル使用メモリ 77,400 KB
実行使用メモリ 76,636 KB
最終ジャッジ日時 2023-08-30 03:50:11
合計ジャッジ時間 4,814 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
76,204 KB
testcase_01 AC 72 ms
76,440 KB
testcase_02 AC 73 ms
76,372 KB
testcase_03 AC 72 ms
76,636 KB
testcase_04 AC 72 ms
76,368 KB
testcase_05 AC 73 ms
76,112 KB
testcase_06 AC 72 ms
76,320 KB
testcase_07 AC 73 ms
76,320 KB
testcase_08 AC 73 ms
76,368 KB
testcase_09 AC 73 ms
76,116 KB
testcase_10 AC 71 ms
76,356 KB
testcase_11 AC 73 ms
76,428 KB
testcase_12 AC 72 ms
76,364 KB
testcase_13 AC 73 ms
76,364 KB
testcase_14 AC 71 ms
76,444 KB
testcase_15 AC 72 ms
76,540 KB
testcase_16 AC 73 ms
76,312 KB
testcase_17 AC 73 ms
76,340 KB
testcase_18 AC 72 ms
76,540 KB
testcase_19 AC 71 ms
76,564 KB
testcase_20 AC 72 ms
76,212 KB
testcase_21 AC 72 ms
76,408 KB
testcase_22 AC 73 ms
76,396 KB
testcase_23 AC 73 ms
76,104 KB
testcase_24 AC 72 ms
76,420 KB
testcase_25 AC 71 ms
76,536 KB
testcase_26 AC 73 ms
76,372 KB
testcase_27 AC 73 ms
76,556 KB
testcase_28 AC 73 ms
76,168 KB
testcase_29 AC 73 ms
76,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

nw = input()
w = map(int, raw_input().split())
nb = input()
b = map(int, raw_input().split())

w.sort(reverse = True)
b.sort(reverse = True)

def solve(nw, w, nb, b):
	i = 0
	j = 0
	res = 0
	under = float('inf')

	updated = True
	k = 0
	while updated:
		updated = False
		if k % 2 == 0:
			while i < nw and w[i] >= under:
				i += 1
			if i < nw:
				under = w[i]
				res += 1
				updated = True
		else:
			while j < nb and b[j] >= under:
				j += 1
			if j < nb:
				under = b[j]
				res += 1
				updated = True
		k += 1
	return res

ans = max(solve(nw, w, nb, b), solve(nb, b, nw, w))
print ans
0