結果
問題 | No.1570 Blocks |
ユーザー |
👑 |
提出日時 | 2021-07-25 14:00:40 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 127 ms / 2,000 ms |
コード長 | 384 bytes |
コンパイル時間 | 196 ms |
コンパイル使用メモリ | 6,812 KB |
実行使用メモリ | 6,144 KB |
最終ジャッジ日時 | 2024-07-20 22:00:14 |
合計ジャッジ時間 | 6,776 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 45 |
ソースコード
local n = io.read("*n")local a, b = {}, {}local idx = {}for i = 1, n doa[i], b[i] = io.read("*n", "*n")idx[i] = iendtable.sort(idx, function(x, y) return a[x] + b[x] > a[y] + b[y] end)local sum = 0for i = 1, n do sum = sum + a[i] endfor i = 1, n doif sum - a[idx[i]] <= b[idx[i]] thensum = sum - a[idx[i]]elseprint("No") os.exit()endendprint("Yes")