Submission #3300415
Source Code Expand
N = gets.to_i
POINTS = readlines.map{|l| l.split.map(&:to_i)}
m = POINTS.map{|x, y| x.abs + y.abs}.max
parity = (POINTS[0][0].abs + POINTS[0][1].abs) % 2
def command(x, y, m)
ret = ""
if x >= 0
ret << 'R' * x
else
ret << 'L' * (-x)
end
if y >= 0
ret << 'U' * y
ret << 'DU' * ((m - x.abs - y.abs)/2)
else
ret << 'D' * -y
ret << 'UD' * ((m - x.abs - y.abs)/2)
end
ret
end
if POINTS.any?{|x, y| (x.abs + y.abs) % 2 != parity}
p -1
else
puts m
puts ([1] * m).join(' ')
POINTS.each do |x, y|
puts command(x, y, m)
end
end
Submission Info
| Submission Time | |
|---|---|
| Task | D - Robot Arms |
| User | yhara |
| Language | Ruby (2.3.3) |
| Score | 300 |
| Code Size | 604 Byte |
| Status | RE |
| Exec Time | 11 ms |
| Memory | 2044 KiB |
Compile Error
./Main.rb:24: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Judge Result
| Set Name | Sample | subtask | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | 0 / 300 | ||||||||
| Status |
|
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample1.txt, sample2.txt, sample3.txt, sample4.txt |
| subtask | sample1.txt, sample2.txt, sample3.txt, sample4.txt, sub1.txt, sub10.txt, sub11.txt, sub12.txt, sub13.txt, sub14.txt, sub15.txt, sub16.txt, sub2.txt, sub3.txt, sub4.txt, sub5.txt, sub6.txt, sub7.txt, sub8.txt, sub9.txt |
| All | sample1.txt, sample2.txt, sample3.txt, sample4.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 3.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt, sample4.txt, sub1.txt, sub10.txt, sub11.txt, sub12.txt, sub13.txt, sub14.txt, sub15.txt, sub16.txt, sub2.txt, sub3.txt, sub4.txt, sub5.txt, sub6.txt, sub7.txt, sub8.txt, sub9.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 1.txt | RE | 8 ms | 1788 KiB |
| 10.txt | AC | 9 ms | 1788 KiB |
| 11.txt | RE | 10 ms | 1916 KiB |
| 12.txt | AC | 9 ms | 1788 KiB |
| 13.txt | RE | 9 ms | 1916 KiB |
| 14.txt | RE | 10 ms | 1788 KiB |
| 15.txt | RE | 10 ms | 1788 KiB |
| 16.txt | RE | 10 ms | 1788 KiB |
| 17.txt | AC | 9 ms | 1788 KiB |
| 18.txt | RE | 10 ms | 1788 KiB |
| 19.txt | RE | 10 ms | 1788 KiB |
| 2.txt | AC | 7 ms | 1788 KiB |
| 20.txt | RE | 10 ms | 1788 KiB |
| 21.txt | AC | 9 ms | 1788 KiB |
| 22.txt | AC | 9 ms | 1788 KiB |
| 23.txt | RE | 10 ms | 1788 KiB |
| 24.txt | RE | 10 ms | 1788 KiB |
| 25.txt | RE | 10 ms | 1788 KiB |
| 26.txt | RE | 10 ms | 1788 KiB |
| 27.txt | AC | 9 ms | 1788 KiB |
| 28.txt | RE | 10 ms | 1788 KiB |
| 29.txt | RE | 10 ms | 1788 KiB |
| 3.txt | RE | 9 ms | 1788 KiB |
| 30.txt | RE | 10 ms | 1788 KiB |
| 31.txt | RE | 9 ms | 1788 KiB |
| 32.txt | RE | 10 ms | 1788 KiB |
| 33.txt | RE | 10 ms | 1788 KiB |
| 34.txt | RE | 9 ms | 1788 KiB |
| 4.txt | RE | 9 ms | 1916 KiB |
| 5.txt | RE | 10 ms | 1788 KiB |
| 6.txt | RE | 9 ms | 1788 KiB |
| 7.txt | AC | 9 ms | 1788 KiB |
| 8.txt | RE | 10 ms | 1916 KiB |
| 9.txt | RE | 10 ms | 1788 KiB |
| sample1.txt | AC | 7 ms | 1788 KiB |
| sample2.txt | AC | 7 ms | 1788 KiB |
| sample3.txt | AC | 7 ms | 1788 KiB |
| sample4.txt | AC | 7 ms | 1788 KiB |
| sub1.txt | AC | 7 ms | 1788 KiB |
| sub10.txt | AC | 9 ms | 1788 KiB |
| sub11.txt | AC | 10 ms | 2044 KiB |
| sub12.txt | AC | 9 ms | 1788 KiB |
| sub13.txt | AC | 10 ms | 2044 KiB |
| sub14.txt | AC | 11 ms | 2044 KiB |
| sub15.txt | AC | 10 ms | 2044 KiB |
| sub16.txt | AC | 10 ms | 2044 KiB |
| sub2.txt | AC | 7 ms | 1788 KiB |
| sub3.txt | AC | 10 ms | 2044 KiB |
| sub4.txt | AC | 10 ms | 2044 KiB |
| sub5.txt | AC | 10 ms | 2044 KiB |
| sub6.txt | AC | 10 ms | 2044 KiB |
| sub7.txt | AC | 9 ms | 1788 KiB |
| sub8.txt | AC | 11 ms | 2044 KiB |
| sub9.txt | AC | 10 ms | 2044 KiB |