Submission #2619945
Source Code Expand
$b = 2.times.map{gets.chomp.split(" ").map(&:to_i)} $c = 3.times.map{gets.chomp.split(" ").map(&:to_i)} $sum = 0 $b.each{|a|$sum += a.inject(:+)} $c.each{|a|$sum += a.inject(:+)} def game(stack,n) if n != 9 if n%2 == 0 score = 0 else score = $sum end for i in 0..8 if !(stack[i]) stack[i] = n%2 temp = game(stack,n+1) stack[i] = false if n%2 == 0 && score < temp score = temp elsif n%2 == 1 && score > temp score = temp end end end else score = 0 for i in 0..2 for j in 0..1 if stack[i+3*j] == stack[i+3*(j+1)] score += $b[j][i] end if stack[3*i+j] == stack[3*i+j+1] score += $c[i][j] end end end end return score end stack = Array.new(9,false) ans = game(stack,0) p ans,$sum-ans
Submission Info
Submission Time | |
---|---|
Task | C - 双子と○×ゲーム |
User | koikotya |
Language | Ruby (2.3.3) |
Score | 100 |
Code Size | 916 Byte |
Status | AC |
Exec Time | 1685 ms |
Memory | 3836 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
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 | AC | 1679 ms | 1788 KB |
sample-02.txt | AC | 1648 ms | 1788 KB |
test-01.txt | AC | 1660 ms | 1788 KB |
test-02.txt | AC | 1665 ms | 1788 KB |
test-03.txt | AC | 1657 ms | 1788 KB |
test-04.txt | AC | 1685 ms | 1788 KB |
test-05.txt | AC | 1678 ms | 1788 KB |
test-06.txt | AC | 1647 ms | 1788 KB |
test-07.txt | AC | 1644 ms | 3836 KB |
test-08.txt | AC | 1651 ms | 1788 KB |
test-09.txt | AC | 1662 ms | 1788 KB |
test-10.txt | AC | 1680 ms | 1788 KB |
test-11.txt | AC | 1633 ms | 1788 KB |
test-12.txt | AC | 1664 ms | 1788 KB |
test-13.txt | AC | 1674 ms | 1788 KB |
test-14.txt | AC | 1630 ms | 1788 KB |
test-15.txt | AC | 1659 ms | 1788 KB |
test-16.txt | AC | 1637 ms | 1916 KB |
test-17.txt | AC | 1674 ms | 1788 KB |
test-18.txt | AC | 1645 ms | 1788 KB |
test-19.txt | AC | 1652 ms | 1788 KB |
test-20.txt | AC | 1659 ms | 1788 KB |