結果

問題 No.3453 Crape Shop
コンテスト
ユーザー sasa8uyauya
提出日時 2026-02-28 19:28:59
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 240 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 370 ms
コンパイル使用メモリ 78,016 KB
実行使用メモリ 84,024 KB
最終ジャッジ日時 2026-02-28 19:29:03
合計ジャッジ時間 3,446 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n=int(input())
c=list(map(int,input().split()))
p=list(map(int,input().split()))
for i in range(n):
	if all(c[j]>0 for j in range(2) if (p[i]>>j)&1):
		for j in range(2):
			if (p[i]>>j)&1:
				c[j]-=1
	else:
		print(i+1)
		exit()
print(-1)
0