結果
| 問題 |
No.482 あなたの名は
|
| コンテスト | |
| ユーザー |
jj
|
| 提出日時 | 2017-02-10 22:58:49 |
| 言語 | Fortran (gFortran 14.2.0) |
| 結果 |
AC
|
| 実行時間 | 44 ms / 2,000 ms |
| コード長 | 929 bytes |
| コンパイル時間 | 862 ms |
| コンパイル使用メモリ | 32,000 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-29 20:20:32 |
| 合計ジャッジ時間 | 2,775 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
コンパイルメッセージ
Main.f90:41:30:
41 | write(cformat(5:9),'(i0)'),size(array)
| 1
Warning: Legacy Extension: Comma before i/o item list at (1)
ソースコード
program main
implicit none
integer*8::N,K,i,j,count,tmp,tmp2,total
integer*8,allocatable::D(:)
data count/0/,total/0/
read *,N,K
allocate(D(N))
read *,D
do i=1, N-1
if(D(i).ne.i) then
count = 0
tmp = i
do
tmp2 = D(tmp)
! print *,tmp,tmp2
D(tmp) = tmp
tmp = tmp2
count = count + 1
if(tmp.eq.i) then
total = total + count - 1
exit
end if
end do
end if
end do
if(total .gt. K ) then
print '("NO")'
else if(MOD(total,2).eq.MOD(K,2)) then
print '("YES")'
else
print '("NO")'
end if
! print *, total, K
! 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
jj