Submission #4678039


Source Code Expand

program twin_and_ox_game
  implicit none
  integer :: b(2,3), c(3,2), g(9), h(3,3)
  integer :: ubnd, i, j, k, l, m
  integer :: tbro, tsis, bro, sis
  b = 0
  c = 0
  read(*,*) b(1,1), b(1,2), b(1,3)
  read(*,*) b(2,1), b(2,2), b(2,3)
  read(*,*) c(1,1), c(1,2)
  read(*,*) c(2,1), c(2,2)
  read(*,*) c(3,1), c(3,2)
  ubnd = 2**9 - 1
  bro = 0
  sis = 0
  do m = 1, ubnd
    g = 0
    do k = 1, 9
      if (btest(m,k-1)) then
        g(k) = 1
      else
        g(k) = -1
      end if
    end do
    if (sum(g).ne.1) cycle
    do k = 1, 9
      l = mod(k,3)
      if (l.eq.0) l = 3
      h((k+2)/3,l) = g(k)
    end do
    tbro = 0
    tsis = 0
    do i = 1, 2
      do j = 1, 3
        if (h(i,j)+h(i+1,j).eq.0) then
          tbro = tbro + b(i,j)
        else
          tsis = tsis + b(i,j)
        end if
      end do
    end do
    do j = 1, 2
      do i = 1, 3
        if (h(i,j)+h(i,j+1).eq.0) then
          tbro = tbro + c(i,j)
        else
          tsis = tsis + c(i,j)
        end if
      end do
    end do
    if (sis.lt.tsis) then
      sis = tsis
      bro = tbro
    else if (sis.eq.tsis.and.bro.lt.tbro) then
      bro = tbro
    end if
  end do
  write(*,'(i0)') tbro
  write(*,'(i0)') tsis
  stop
end program twin_and_ox_game

Submission Info

Submission Time
Task C - 双子と○×ゲーム
User ue1221
Language Fortran (gfortran v4.8.4)
Score 0
Code Size 1305 Byte
Status WA
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
AC × 1
WA × 1
AC × 4
WA × 20
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 2 ms 256 KB
sample-02.txt WA 1 ms 256 KB
test-01.txt WA 1 ms 256 KB
test-02.txt AC 1 ms 256 KB
test-03.txt WA 1 ms 256 KB
test-04.txt WA 1 ms 256 KB
test-05.txt WA 1 ms 256 KB
test-06.txt WA 1 ms 256 KB
test-07.txt WA 1 ms 256 KB
test-08.txt WA 1 ms 256 KB
test-09.txt WA 1 ms 256 KB
test-10.txt WA 1 ms 256 KB
test-11.txt AC 1 ms 256 KB
test-12.txt WA 1 ms 256 KB
test-13.txt WA 1 ms 256 KB
test-14.txt WA 1 ms 256 KB
test-15.txt WA 1 ms 256 KB
test-16.txt WA 1 ms 256 KB
test-17.txt WA 1 ms 256 KB
test-18.txt WA 1 ms 256 KB
test-19.txt WA 1 ms 256 KB
test-20.txt WA 1 ms 256 KB