結果
問題 |
No.1093 区間の和 / Sum of Range
|
ユーザー |
![]() |
提出日時 | 2022-10-07 00:25:52 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 90 ms / 2,000 ms |
コード長 | 504 bytes |
コンパイル時間 | 2,390 ms |
コンパイル使用メモリ | 212,952 KB |
実行使用メモリ | 9,340 KB |
最終ジャッジ日時 | 2024-06-22 16:20:19 |
合計ジャッジ時間 | 6,590 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 36 |
ソースコード
import std; void main() { long N, K; readf("%d %d\n", N, K); auto a = readln.chomp.split.to!(long[]); long num; long[] S; foreach (i, x; a) { num += x; if (i >= K - 1) { S ~= num; num -= a[i-K+1]; } } auto T = S.sort; long Q; readf("%d\n", Q); foreach (_; 0 .. Q) { long x; readf("%d\n", x); auto lb = T.lowerBound(x+1); auto res = lb.length; res.writeln; } }