結果

問題 No.755 Zero-Sum Rectangle
ユーザー s0j1san
提出日時 2018-12-13 22:33:45
言語 Fortran
(gFortran 14.2.0)
結果
WA  
実行時間 -
コード長 908 bytes
コンパイル時間 1,912 ms
コンパイル使用メモリ 35,644 KB
実行使用メモリ 8,992 KB
最終ジャッジ日時 2024-09-25 04:45:05
合計ジャッジ時間 5,945 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 2 WA * 9 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
   implicit none
   integer n,m,i
   integer,allocatable,dimension(:,:)::a
   integer,allocatable,dimension(:)::x,y
   read(*,*)n,m
   allocate(a(m,m))
   allocate(y(n),x(n))
   do i=1,m 
      read(*,*)a(i,1:m)
   enddo
   do i=1,n
      read(*,*)x(i),y(i)
   enddo
   do i=1,n
      call hantei(x(i),y(i))
   enddo
contains
   subroutine hantei(x,y)
      integer,intent(in)::x,y
      integer ::i,j,counter
      counter=0
      do i=1,x-1
         do j=1,y-1
            if(sum(a(i:x,j:y))==0)counter=counter+1
         enddo
         do j=y,m
            if(sum(a(i:x,y:j))==0)counter=counter+1
         enddo
      enddo
      do i=x,m
         do j=1,y-1
            if(sum(a(x:i,j:y))==0)counter=counter+1
         enddo
         do j=y,m
            if(sum(a(x:i,y:j))==0)counter=counter+1
         enddo
      enddo
      write(*,*)counter
   end subroutine hantei
end program main   
0