結果

問題 No.412 花火大会
ユーザー 37zigen37zigen
提出日時 2018-04-22 00:16:37
言語 Fortran
(gFortran 13.2.0)
結果
TLE  
実行時間 -
コード長 1,223 bytes
コンパイル時間 777 ms
コンパイル使用メモリ 28,272 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-09 12:26:40
合計ジャッジ時間 4,739 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,756 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

module mdl
contains
    recursive subroutine qsort(a,s,t)
        integer*8::a(:),s,t,i,j,m
        if(t-s<=1)return
        i=s
        j=t-1
        m=a((s+t)/2)
        do
            do while(a(i)<m)
                i=i+1
            end do
            do while(a(j)>m)
                j=j-1
            end do
            if(i>=j)exit
            a(i)=xor(a(i),a(j))
            a(j)=xor(a(i),a(j))
            a(i)=xor(a(i),a(j))
            i=i+1
            j=j-1
        end do
        call qsort(a,s,i)
        call qsort(a,j+1,t)
    end subroutine

end module


program main
    use mdl
    implicit none
    integer*8::B,C,D,N,i,j,k,p,ans=0,arr(3),a(3)
    integer*8,allocatable::E(:)
    read(*,*)B,C,D
    a(1)=B
    a(2)=C
    a(3)=D
    call qsort(a,1_8,4_8)
    read*,N
    allocate(E(N))

    read*,(E(i),i=1,N)
    call qsort(E,int(1,8),int(size(E)+1,8))
    do i=1,lshift(1,N)-1
        if(popcnt(i)<3)cycle
        p=1
        do j=N-1,0,-1
            if(mod(rshift(i,j),2)==1)then
                arr(p)=E(j+1)
                p=p+1
            end if
            if(p==4)exit
        end do
        if(a(1)<=arr(3).and.a(2)<=arr(2).and.a(3)<=arr(1))ans=ans+1
    end do
    print*,ans

end program
0