結果
| 問題 |
No.142 単なる配列の操作に関する実装問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-07-25 17:22:11 |
| 言語 | Fortran (gFortran 14.2.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,222 bytes |
| コンパイル時間 | 1,898 ms |
| コンパイル使用メモリ | 33,280 KB |
| 実行使用メモリ | 21,100 KB |
| 最終ジャッジ日時 | 2024-07-19 17:01:31 |
| 合計ジャッジ時間 | 15,483 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 1 TLE * 1 -- * 3 |
コンパイルメッセージ
Main.f90:19:45:
19 | write (*,fmt='(a)', advance='no'),"O"
| 1
Warning: Legacy Extension: Comma before i/o item list at (1)
Main.f90:21:45:
21 | write (*,fmt='(a)', advance='no'),"E"
| 1
Warning: Legacy Extension: Comma before i/o item list at (1)
ソースコード
program main
implicit none
integer N,S,X,Y,Z,Q
integer i,j
integer :: int_arr
logical,allocatable :: arr(:)
read *,N,S,X,Y,Z
call mk_int_arr
read *,Q
do i = 1, Q
call modify_arr
end do
do i = 1, N
if ( arr(i) .eqv. .true. ) then
write (*,fmt='(a)', advance='no'),"O"
else
write (*,fmt='(a)', advance='no'),"E"
end if
end do
write (*,fmt='(a)') ""
contains
subroutine mk_int_arr
implicit none
integer i,prev
logical mod2
allocate(arr(N))
prev = S
arr(1) = mod(prev, 2) == 1
do i = 1, N-1
!write(*,*) prev
prev = mod(X * prev + Y,Z)
mod2 = mod(prev, 2) == 1
arr(i+1) = mod2
end do
end subroutine
subroutine modify_arr
implicit none
integer CPin1,CPin2,CPout1,CPout2
integer i,j,length
logical,allocatable :: mini_arr(:)
read *,CPin1,CPin2,CPout1,CPout2
length=CPin2-CPin1+1
allocate(mini_arr(length))
do i = 1, length
mini_arr(i)=arr(CPin1+i-1)
end do
do j = 1, length
arr(j+CPout1-1)=xor(arr(j+CPout1-1),mini_arr(j))
end do
!write (*,*) arr
end subroutine
end program main