結果
| 問題 |
No.865 24時間降水量
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2022-04-23 03:33:36 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 386 bytes |
| コンパイル時間 | 261 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 37,024 KB |
| 最終ジャッジ日時 | 2024-06-24 09:07:19 |
| 合計ジャッジ時間 | 8,375 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 2 WA * 13 TLE * 1 -- * 2 |
コンパイルメッセージ
Main.rb:5: warning: assigned but unused variable - sum Syntax OK
ソースコード
N = gets.to_i
A = gets.split.map(&:to_i)
Q = gets.to_i
sum = A.sum
def f(idx)
res = 0
-23.upto(0) do |d|
from = idx + d
to = from + 23
next if from < 0
next if to >= N
sum = 0
from.upto(to) do |idx|
sum += A[idx]
end
res = sum if res < sum
end
res
end
Q.times do
t, v = gets.split.map(&:to_i)
A[t - 1] = v
puts f(t - 1)
end
siman