結果
| 問題 |
No.2601 Very Poor
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-12 22:22:22 |
| 言語 | Fortran (gFortran 14.2.0) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 2,000 ms |
| コード長 | 807 bytes |
| コンパイル時間 | 1,606 ms |
| コンパイル使用メモリ | 32,640 KB |
| 実行使用メモリ | 7,680 KB |
| 最終ジャッジ日時 | 2024-09-30 06:25:57 |
| 合計ジャッジ時間 | 3,758 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
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