Please sign in first.
Submission #512960
Source Code Expand
n, t = gets.chomp.split(" ").map(&:to_i)
w = []
remb = 0
n.times do
a, b = gets.chomp.split(" ").map(&:to_i)
s = a - b
tmp = [s, a, b]
w << tmp
remb += b
end
tt = t
cpy = 0
sum = 0
mm = w.sort_by {|tmp| tmp[0]}
m = []
mm.each do |row|
r = [row[0], row[1], row[2], remb]
m << r
remb -= row[2]
end
m.each do |row|
sum += row[2]
if t >= row[1] + row[3] - row[2]
if t >= row[1]
t = t - row[1]
else
if t >= row[2]
t = t - row[2]
cpy += 1
end
end
else
cpy += 1
end
end
if sum > tt
cpy = -1
end
puts("#{cpy}")
Submission Info
| Submission Time | |
|---|---|
| Task | C - 8月31日 |
| User | hujita |
| Language | Ruby (2.1.5p273) |
| Score | 30 |
| Code Size | 613 Byte |
| Status | WA |
| Exec Time | 742 ms |
| Memory | 20748 KiB |
Compile Error
./Main.rb:30: warning: mismatched indentations at 'end' with 'if' at 27
Judge Result
| Set Name | Sample | Dataset1 | Dataset2 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 30 / 30 | 0 / 70 | ||||||||
| Status |
|
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt, sample-05.txt |
| Dataset1 | sample-01, sample-02, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt |
| Dataset2 | sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt, sample-05.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt, 02-14.txt, 02-15.txt, 02-16.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01-01.txt | AC | 62 ms | 5136 KiB |
| 01-02.txt | AC | 63 ms | 5096 KiB |
| 01-03.txt | AC | 62 ms | 5096 KiB |
| 01-04.txt | AC | 59 ms | 5096 KiB |
| 01-05.txt | AC | 76 ms | 5356 KiB |
| 01-06.txt | AC | 730 ms | 20576 KiB |
| 01-07.txt | AC | 676 ms | 19472 KiB |
| 01-08.txt | AC | 594 ms | 18668 KiB |
| 01-09.txt | AC | 142 ms | 6924 KiB |
| 01-10.txt | AC | 281 ms | 10084 KiB |
| 01-11.txt | AC | 731 ms | 20568 KiB |
| 01-12.txt | AC | 633 ms | 20576 KiB |
| 01-13.txt | AC | 721 ms | 20572 KiB |
| 01-14.txt | AC | 623 ms | 20576 KiB |
| 01-15.txt | AC | 628 ms | 20612 KiB |
| 02-01.txt | AC | 60 ms | 5096 KiB |
| 02-02.txt | AC | 60 ms | 5096 KiB |
| 02-03.txt | WA | 63 ms | 5184 KiB |
| 02-04.txt | WA | 67 ms | 5228 KiB |
| 02-05.txt | AC | 130 ms | 6468 KiB |
| 02-06.txt | WA | 742 ms | 20576 KiB |
| 02-07.txt | WA | 732 ms | 20748 KiB |
| 02-08.txt | WA | 736 ms | 20576 KiB |
| 02-09.txt | WA | 651 ms | 19128 KiB |
| 02-10.txt | WA | 713 ms | 20080 KiB |
| 02-11.txt | WA | 152 ms | 7156 KiB |
| 02-12.txt | AC | 729 ms | 20576 KiB |
| 02-13.txt | AC | 733 ms | 20576 KiB |
| 02-14.txt | WA | 645 ms | 20556 KiB |
| 02-15.txt | WA | 645 ms | 20576 KiB |
| 02-16.txt | WA | 641 ms | 20576 KiB |
| sample-01.txt | AC | 62 ms | 5136 KiB |
| sample-02.txt | AC | 60 ms | 5188 KiB |
| sample-03.txt | AC | 60 ms | 5148 KiB |
| sample-04.txt | AC | 61 ms | 5072 KiB |
| sample-05.txt | AC | 61 ms | 5084 KiB |