#1450371

Solution for 0033: Ball by iwamot

Source Code Status Test Cases
    Policy: public     Reviewed: 110    
00.02 sec    6100 KB    14 lines     314 bytes    2015-07-18 20:05
def dfs(balls, i, b, c)
  return true if i == balls.size
  return true if balls[i] > b && dfs(balls, i + 1, balls[i], c)
  return true if balls[i] > c && dfs(balls, i + 1, b, balls[i])
  return false
end

n = gets.to_i
n.times do
  balls = gets.split(' ').map(&:to_i)
  puts dfs(balls, 0, 0, 0) ? 'YES' : 'NO'
end


Compile Error Logs:
You are not authorized to see the message.

Status
Judge: 1/1 Ruby CPU: 00.02 sec Memory: 6100 KB Length: 314 B 2015-07-18 20:05 2015-07-18 20:05
Results for testcases
Case # Verdict CPU Time Memory In Out Case Name
Case #1: : Accepted 00.02 sec 6100 KB
< prev | / | next >  
 
Judge Input #  ( | ) Judge Output #  ( | )


Comments
 
 Under Construction.
 
Categories
 
 
Free Tags