結果

問題 No.351 市松スライドパズル
ユーザー jj
提出日時 2016-08-11 23:21:32
言語 Fortran
(gFortran 14.2.0)
結果
AC  
実行時間 303 ms / 2,000 ms
コード長 631 bytes
コンパイル時間 1,373 ms
コンパイル使用メモリ 32,248 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-25 03:03:50
合計ジャッジ時間 5,550 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  type hand
     character::RC
     integer::index
  end type hand
  integer::H,W,N,i,j,index,r,c
  character::rc
  type(hand),allocatable::hands(:)
  integer,parameter::white=0,black=1

  read *,H,W
  read *,N
  allocate(hands(N))
  read *,hands
  r = 0
  c = 0
  do i=N,1,-1
     rc    = hands(i)%RC
     index = hands(i)%index
     select case(rc)
     case ('R')
        if(index.eq.r) c = MOD(c-1+W,W)
     case ('C')
        if(index.eq.c) r = MOD(r-1+H,H)
     end select
  end do
  if(MOD(r+c,2).eq.white) then
     print '(a)',"white"
  else
     print '(a)',"black"
  end if
end program main
0