結果

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

ソースコード

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