Submission #1455639
Source Code Expand
n = gets.chomp.to_i dis = gets.chomp.split(" ").map(&:to_i) dis.sort! max_height = dis[0] if dis[1] == 1 and n > 2 puts "Impossible" exit(0) end if dis[-1] > max_height * 2 puts "Impossible" exit(0) end level = {} dis.each do |d| l = d - max_height level[l] = (level[l] || 0) + 1 end puts level (2..max_height).each do |l| if level[l] > 1 and level[l - 1] <= 1 puts "Impossible" exit(0) end end puts "Possible"
Submission Info
Submission Time | |
---|---|
Task | C - Tree Restoring |
User | hirokizaka46 |
Language | Ruby (2.3.3) |
Score | 0 |
Code Size | 480 Byte |
Status | RE |
Exec Time | 7 ms |
Memory | 1788 KB |
Judge Result
Set Name | Sample | All | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example0, example1, example2, example3, example4, example5 |
All | almostline0, almostline1, almostline2, almostline3, can0, can1, can2, can3, can4, can5, can6, deg0, deg1, deg2, deg3, example0, example1, example2, example3, example4, example5, handmade0, line0, line1, line2, line3, ng10, ng11, ng12, ng13, ng20, ng21, ng22, ng23, plus0, plus1, plus2, plus3, rand0, rand1, rand2, star0, star1, star2, star3 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
almostline0 | RE | 7 ms | 1788 KB |
almostline1 | RE | 7 ms | 1788 KB |
almostline2 | RE | 7 ms | 1788 KB |
almostline3 | WA | 7 ms | 1788 KB |
can0 | WA | 7 ms | 1788 KB |
can1 | WA | 7 ms | 1788 KB |
can2 | WA | 7 ms | 1788 KB |
can3 | WA | 7 ms | 1788 KB |
can4 | WA | 7 ms | 1788 KB |
can5 | RE | 7 ms | 1788 KB |
can6 | RE | 7 ms | 1788 KB |
deg0 | RE | 7 ms | 1788 KB |
deg1 | WA | 7 ms | 1788 KB |
deg2 | RE | 7 ms | 1788 KB |
deg3 | WA | 7 ms | 1788 KB |
example0 | RE | 7 ms | 1788 KB |
example1 | AC | 7 ms | 1788 KB |
example2 | WA | 7 ms | 1788 KB |
example3 | AC | 7 ms | 1788 KB |
example4 | AC | 7 ms | 1788 KB |
example5 | WA | 7 ms | 1788 KB |
handmade0 | WA | 7 ms | 1788 KB |
line0 | RE | 7 ms | 1788 KB |
line1 | WA | 7 ms | 1788 KB |
line2 | RE | 7 ms | 1788 KB |
line3 | WA | 7 ms | 1788 KB |
ng10 | RE | 7 ms | 1788 KB |
ng11 | WA | 7 ms | 1788 KB |
ng12 | RE | 7 ms | 1788 KB |
ng13 | AC | 7 ms | 1788 KB |
ng20 | RE | 7 ms | 1788 KB |
ng21 | RE | 7 ms | 1788 KB |
ng22 | RE | 7 ms | 1788 KB |
ng23 | RE | 7 ms | 1788 KB |
plus0 | WA | 7 ms | 1788 KB |
plus1 | AC | 7 ms | 1788 KB |
plus2 | AC | 7 ms | 1788 KB |
plus3 | AC | 7 ms | 1788 KB |
rand0 | AC | 7 ms | 1788 KB |
rand1 | AC | 7 ms | 1788 KB |
rand2 | AC | 7 ms | 1788 KB |
star0 | WA | 7 ms | 1788 KB |
star1 | RE | 7 ms | 1788 KB |
star2 | WA | 7 ms | 1788 KB |
star3 | RE | 7 ms | 1788 KB |