Submission #2618740


Source Code Expand

$b = 2.times.map{gets.chomp.split(" ").map(&:to_i)}
$c = 3.times.map{gets.chomp.split(" ").map(&:to_i)}
def game(stack,f)
  if stack.include?(false)
    temp = [0,0]
    for i in 0..8
      if !(stack[i])
        if f == 0
          stack[i] = 0
        else
          stack[i] = 1
        end
        r = game(stack,1-f)
        if f == 0 && temp[0] < r[0]
          temp = r
        elsif f == 1 && temp[1] < r[1]
          temp = r
        end
        stack[i] = false
      end
    end
    return temp
  else
    score = [0,0]
    for i in 0..2
      for j in 0..1
        if stack[i+3*j] == stack[i+3*(j+1)]
          score[0] += $b[j][i]
        else
          score[1] += $b[j][i]
        end
        if stack[3*i+j] == stack[3*i+j+1]
          score[0] += $c[i][j]
        else
          score[1] += $c[i][j]
        end
      end
    end
    return score
  end
end
stack = Array.new(9,false)
puts game(stack,0)

Submission Info

Submission Time
Task C - 双子と○×ゲーム
User koikotya
Language Ruby (2.3.3)
Score 0
Code Size 961 Byte
Status TLE
Exec Time 2107 ms
Memory 1788 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
TLE × 2
TLE × 24
Set Name Test Cases
Sample sample-01.txt, sample-02.txt
All sample-01.txt, sample-02.txt, test-01.txt, test-02.txt, test-03.txt, test-04.txt, test-05.txt, test-06.txt, test-07.txt, test-08.txt, test-09.txt, test-10.txt, test-11.txt, test-12.txt, test-13.txt, test-14.txt, test-15.txt, test-16.txt, test-17.txt, test-18.txt, test-19.txt, test-20.txt, sample-01.txt, sample-02.txt
Case Name Status Exec Time Memory
sample-01.txt TLE 2107 ms 1788 KB
sample-02.txt TLE 2107 ms 1788 KB
test-01.txt TLE 2107 ms 1788 KB
test-02.txt TLE 2107 ms 1788 KB
test-03.txt TLE 2107 ms 1788 KB
test-04.txt TLE 2107 ms 1788 KB
test-05.txt TLE 2107 ms 1788 KB
test-06.txt TLE 2107 ms 1788 KB
test-07.txt TLE 2107 ms 1788 KB
test-08.txt TLE 2107 ms 1788 KB
test-09.txt TLE 2107 ms 1788 KB
test-10.txt TLE 2107 ms 1788 KB
test-11.txt TLE 2107 ms 1788 KB
test-12.txt TLE 2107 ms 1788 KB
test-13.txt TLE 2107 ms 1788 KB
test-14.txt TLE 2107 ms 1788 KB
test-15.txt TLE 2107 ms 1788 KB
test-16.txt TLE 2107 ms 1788 KB
test-17.txt TLE 2107 ms 1788 KB
test-18.txt TLE 2107 ms 1788 KB
test-19.txt TLE 2107 ms 1788 KB
test-20.txt TLE 2107 ms 1788 KB