結果

問題 No.1031 いたずら好きなお姉ちゃん
コンテスト
ユーザー さとみん
提出日時 2020-05-04 20:18:49
言語 Fortran
(gFortran 15.2.0)
コンパイル:
gfortran _filename_ -O2 -o ./a.out
実行:
./a.out
結果
TLE  
実行時間 -
コード長 696 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,212 ms
コンパイル使用メモリ 40,496 KB
実行使用メモリ 15,940 KB
最終ジャッジ日時 2026-03-11 02:29:20
合計ジャッジ時間 233,860 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 TLE * 51
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

module yukicoder1031
    implicit none
    
    integer :: n
    
    integer, allocatable :: p(:)
    
contains
    subroutine read_input
        read *, n
        allocate(p(n))
        read *, p
    end subroutine read_input
end module yukicoder1031

program main
    use yukicoder1031
    implicit none
    
    integer :: r = 0
    
    integer :: i, j
    integer :: max_index, min_index
    
    call read_input
    
    do i = 1, n
        do j = i+1, n
            max_index = maxloc(p(i:j), 1)
            min_index = minloc(p(i:j), 1)
            
            r = r + merge(1, 0, abs(max_index - min_index) == j - i)
        end do
    end do
    
    print '(I0)', r
end program main
0