結果
問題 | No.11 カードマッチ |
ユーザー | 37zigen |
提出日時 | 2018-04-08 20:09:05 |
言語 | Fortran (gFortran 13.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 876 bytes |
コンパイル時間 | 1,278 ms |
コンパイル使用メモリ | 30,044 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-09 03:13:06 |
合計ジャッジ時間 | 2,161 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 1 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 1 ms
4,376 KB |
testcase_08 | AC | 1 ms
4,376 KB |
testcase_09 | AC | 2 ms
4,376 KB |
testcase_10 | AC | 1 ms
4,380 KB |
testcase_11 | AC | 1 ms
4,380 KB |
testcase_12 | AC | 2 ms
4,376 KB |
testcase_13 | AC | 2 ms
4,376 KB |
testcase_14 | AC | 1 ms
4,376 KB |
testcase_15 | AC | 1 ms
4,380 KB |
testcase_16 | AC | 1 ms
4,376 KB |
testcase_17 | AC | 1 ms
4,380 KB |
testcase_18 | AC | 1 ms
4,376 KB |
ソースコード
module mdl contains recursive function qsort(a)result(res) implicit none integer,intent(in)::a(:) integer::res(size(a)) if(size(a)<=1)then res=a return end if res=[qsort(pack(a(2:),a(2:)<a(1))),a(1),qsort(pack(a(2:),a(2:)>=a(1)))] end function qsort end module program main use mdl implicit none integer::i,j,k,l,m,cnt1=0,cnt2=0,N,W,H integer,allocatable::a(:),b(:) integer::ans read*,W read*,H read*,N allocate(a(N)) allocate(b(N)) do i=1,N read(*,*)a(i),b(i) end do a=qsort(a) b=qsort(b) do i=1,N if(i+1<=N.and.a(i)==a(i+1))cycle cnt1=cnt1+1 end do do i=1,N if(i+1<=N.and.b(i)==b(i+1))cycle cnt2=cnt2+1 end do ans=H*W-(W-cnt1)*(H-cnt2)-N print*,ans end program main