結果
| 問題 |
No.1570 Blocks
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-27 13:30:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 395 bytes |
| コンパイル時間 | 224 ms |
| コンパイル使用メモリ | 82,320 KB |
| 実行使用メモリ | 93,144 KB |
| 最終ジャッジ日時 | 2024-06-25 11:26:18 |
| 合計ジャッジ時間 | 14,534 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 44 WA * 1 |
ソースコード
from itertools import permutations
def ok(ab):
s = 0
for i in range(n):
if s > ab[i][1]:
break
else:
s += ab[i][0]
else:
exit(print("Yes"))
n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort(key=lambda x: (x[1], x[0]))
if n <= 9:
for p in permutations(ab, n):
ok(list(p))
ok(ab)
print("No")