結果

問題 No.2601 Very Poor
ユーザー osada-yumosada-yum
提出日時 2024-01-12 22:22:22
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 807 bytes
コンパイル時間 1,545 ms
コンパイル使用メモリ 32,512 KB
実行使用メモリ 7,552 KB
最終ジャッジ日時 2024-03-20 19:48:51
合計ジャッジ時間 3,988 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 1 ms
6,676 KB
testcase_08 AC 1 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 45 ms
7,552 KB
testcase_16 AC 45 ms
7,552 KB
testcase_17 AC 44 ms
7,552 KB
testcase_18 AC 45 ms
7,552 KB
testcase_19 AC 45 ms
7,552 KB
testcase_20 AC 45 ms
7,552 KB
testcase_21 AC 45 ms
7,552 KB
testcase_22 AC 45 ms
7,552 KB
testcase_23 AC 48 ms
7,552 KB
testcase_24 AC 45 ms
7,552 KB
testcase_25 AC 46 ms
7,552 KB
testcase_26 AC 44 ms
7,552 KB
testcase_27 AC 45 ms
7,552 KB
testcase_28 AC 45 ms
7,552 KB
testcase_29 AC 45 ms
7,552 KB
testcase_30 AC 45 ms
7,552 KB
testcase_31 AC 45 ms
7,552 KB
testcase_32 AC 45 ms
7,552 KB
testcase_33 AC 45 ms
7,552 KB
testcase_34 AC 45 ms
7,552 KB
testcase_35 AC 2 ms
6,676 KB
testcase_36 AC 1 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

program yukicoder_2601
  use, intrinsic :: iso_fortran_env
  implicit none
  integer(int32) :: n, x
  integer(int64) :: ans
  integer(int64), allocatable :: arr(:), cumm_summ(:)
  integer(int32) :: i, j
  read(input_unit, *) n, x
  allocate(arr(n))
  read(input_unit, *) arr(:)
  allocate(cumm_summ(0 : 2 * n))
  cumm_summ(0) = 0_int64
  do i = 1, 2 * n
     cumm_summ(i) = cumm_summ(i - 1) + arr(mod(i - 1, n) + 1)
  end do
  ans = 0
  j = 0
  do i = 1, 2 * n
     j = max(j, i - 1)
     do
        if (j + 1 > 2 * n) exit
        if (j + 1 - i + 1 > n) exit
        if (cumm_summ(j + 1) - cumm_summ(i - 1) > x) exit
        j = j + 1
     end do
     ! write(error_unit, *) j, i - 1
     ans = max(ans, cumm_summ(j) - cumm_summ(i - 1))
  end do
  write(output_unit, '(i0)') ans
end program yukicoder_2601
0