Created
July 15, 2012 04:07
-
-
Save einblicker/3114925 to your computer and use it in GitHub Desktop.
AOJ 0033 Balls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let lineSize = System.Console.ReadLine() |> int | |
for x = 0 to lineSize - 1 do | |
let nums = System.Console.ReadLine().Split([|' '|]) |> Array.map int | |
let suc = ref false | |
let rec dfs i bMax cMax = | |
if i < nums.Length - 1 then | |
if nums.[i] > bMax then | |
dfs (i+1) nums.[i] cMax | |
if nums.[i] > cMax then | |
dfs (i+1) bMax nums.[i] | |
else | |
suc := true | |
dfs 2 nums.[0] nums.[1] | |
printfn "%A" (if !suc then "YES" else "NO") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment