結果

問題 No.482 あなたの名は
ユーザー jj
提出日時 2017-02-10 22:37:53
言語 Fortran
(gFortran 14.2.0)
結果
WA  
実行時間 -
コード長 680 bytes
コンパイル時間 1,963 ms
コンパイル使用メモリ 32,256 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-28 07:45:00
合計ジャッジ時間 2,597 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.f90:31:30:

   31 |     write(cformat(5:9),'(i0)'),size(array)
      |                              1
Warning: Legacy Extension: Comma before i/o item list at (1)

ソースコード

diff #

program main
  implicit none
  integer*8::N,K,i,j,count,tmp
  integer*8,allocatable::D(:)
  data count/0/
  read *,N,K
  allocate(D(N))
  read *,D

  do i=1, N-1
     if(D(i).ne.i) then
        tmp = D(i)
        D(i) = D(tmp)
        D(tmp) = tmp
        count = count + 1
     end if
  end do

  if(count .gt. K ) then
     print '("NO")'
  else if(MOD(count,2).eq.MOD(K,2)) then
     print '("YES")'
  else
     print '("NO")'
  end if
!  call aprinter(D)
contains
  subroutine aprinter(array)
    integer*8::array(:)
    character*32::cformat='(i0,     (1x,i0))'
    write(cformat(5:9),'(i0)'),size(array)
    write(*,cformat) array
  end subroutine aprinter
end program main
0