結果

問題 No.1570 Blocks
ユーザー MaboyMaboy
提出日時 2021-06-28 17:55:45
言語 Swift
(5.10.0)
結果
AC  
実行時間 471 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 9,355 ms
コンパイル使用メモリ 140,548 KB
実行使用メモリ 21,084 KB
最終ジャッジ日時 2023-09-07 19:03:31
合計ジャッジ時間 18,376 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,452 KB
testcase_01 AC 4 ms
8,336 KB
testcase_02 AC 304 ms
15,784 KB
testcase_03 AC 347 ms
17,136 KB
testcase_04 AC 273 ms
15,164 KB
testcase_05 AC 285 ms
15,420 KB
testcase_06 AC 258 ms
15,544 KB
testcase_07 AC 42 ms
9,396 KB
testcase_08 AC 334 ms
17,084 KB
testcase_09 AC 388 ms
18,028 KB
testcase_10 AC 342 ms
16,536 KB
testcase_11 AC 371 ms
17,160 KB
testcase_12 AC 415 ms
18,316 KB
testcase_13 AC 434 ms
18,240 KB
testcase_14 AC 444 ms
18,596 KB
testcase_15 AC 201 ms
12,984 KB
testcase_16 AC 441 ms
18,300 KB
testcase_17 AC 167 ms
12,712 KB
testcase_18 AC 358 ms
16,828 KB
testcase_19 AC 171 ms
12,760 KB
testcase_20 AC 198 ms
12,856 KB
testcase_21 AC 294 ms
16,296 KB
testcase_22 AC 3 ms
8,340 KB
testcase_23 AC 4 ms
8,468 KB
testcase_24 AC 3 ms
8,336 KB
testcase_25 AC 4 ms
8,284 KB
testcase_26 AC 3 ms
8,344 KB
testcase_27 AC 4 ms
8,348 KB
testcase_28 AC 3 ms
8,292 KB
testcase_29 AC 3 ms
8,340 KB
testcase_30 AC 3 ms
8,324 KB
testcase_31 AC 3 ms
8,356 KB
testcase_32 AC 376 ms
18,224 KB
testcase_33 AC 412 ms
18,428 KB
testcase_34 AC 421 ms
17,824 KB
testcase_35 AC 409 ms
18,308 KB
testcase_36 AC 437 ms
18,124 KB
testcase_37 AC 378 ms
17,952 KB
testcase_38 AC 386 ms
18,080 KB
testcase_39 AC 443 ms
18,392 KB
testcase_40 AC 424 ms
18,064 KB
testcase_41 AC 409 ms
18,404 KB
testcase_42 AC 458 ms
21,052 KB
testcase_43 AC 471 ms
21,032 KB
testcase_44 AC 470 ms
21,020 KB
testcase_45 AC 460 ms
21,036 KB
testcase_46 AC 401 ms
21,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let n = Int(readLine()!)!
var ab = [[Int]]()
for _ in 0..<n{
    ab += [readLine()!.split(separator: " ").map{Int($0)!}]
}
var d = [Int:[Int]]()
for i in ab{
    d[i[0] + i[1]] = i
}
var k : Array = Array(d.keys)
k.sort(){$0 < $1}

var s = 0
var t = "Yes"
for i in k{
    if s > d[i]![1]{
        t = "No"
        break
    }else{
        s += d[i]![0]
    }
}
print(t)
0