結果

問題 No.1570 Blocks
ユーザー 👑 obakyanobakyan
提出日時 2021-07-25 14:00:40
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 5,876 KB
最終ジャッジ日時 2023-09-28 03:27:22
合計ジャッジ時間 9,131 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 0 ms
4,376 KB
testcase_02 AC 104 ms
5,812 KB
testcase_03 AC 129 ms
5,420 KB
testcase_04 AC 87 ms
4,376 KB
testcase_05 AC 95 ms
4,376 KB
testcase_06 AC 95 ms
4,376 KB
testcase_07 AC 12 ms
4,376 KB
testcase_08 AC 129 ms
5,476 KB
testcase_09 AC 146 ms
5,672 KB
testcase_10 AC 117 ms
5,876 KB
testcase_11 AC 126 ms
5,876 KB
testcase_12 AC 152 ms
5,580 KB
testcase_13 AC 154 ms
5,748 KB
testcase_14 AC 157 ms
5,764 KB
testcase_15 AC 66 ms
4,380 KB
testcase_16 AC 155 ms
5,876 KB
testcase_17 AC 62 ms
4,376 KB
testcase_18 AC 128 ms
5,872 KB
testcase_19 AC 63 ms
4,380 KB
testcase_20 AC 64 ms
4,376 KB
testcase_21 AC 111 ms
5,352 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 149 ms
5,800 KB
testcase_33 AC 156 ms
5,464 KB
testcase_34 AC 145 ms
5,804 KB
testcase_35 AC 150 ms
5,448 KB
testcase_36 AC 147 ms
5,772 KB
testcase_37 AC 141 ms
5,568 KB
testcase_38 AC 147 ms
5,580 KB
testcase_39 AC 156 ms
5,864 KB
testcase_40 AC 146 ms
5,796 KB
testcase_41 AC 152 ms
5,672 KB
testcase_42 AC 154 ms
5,764 KB
testcase_43 AC 157 ms
5,792 KB
testcase_44 AC 155 ms
5,812 KB
testcase_45 AC 160 ms
5,872 KB
testcase_46 AC 159 ms
5,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local n = io.read("*n")
local a, b = {}, {}
local idx = {}
for i = 1, n do
  a[i], b[i] = io.read("*n", "*n")
  idx[i] = i
end
table.sort(idx, function(x, y) return a[x] + b[x] > a[y] + b[y] end)
local sum = 0
for i = 1, n do sum = sum + a[i] end
for i = 1, n do
  if sum - a[idx[i]] <= b[idx[i]] then
    sum = sum - a[idx[i]]
  else
    print("No") os.exit()
  end
end
print("Yes")
0