結果
| 問題 | No.1093 区間の和 / Sum of Range |
| ユーザー |
kokatsu
|
| 提出日時 | 2022-10-07 00:25:52 |
| 言語 | D (dmd 2.112.0) |
| 結果 |
AC
|
| 実行時間 | 68 ms / 2,000 ms |
| + 373µs | |
| コード長 | 504 bytes |
| 記録 | |
| コンパイル時間 | 1,132 ms |
| コンパイル使用メモリ | 193,664 KB |
| 実行使用メモリ | 7,996 KB |
| 最終ジャッジ日時 | 2026-07-27 06:01:36 |
| 合計ジャッジ時間 | 4,580 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 36 |
コンパイルメッセージ
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/core/checkedint.d(814): Warning: cannot inline function `core.checkedint.mulu!().mulu`
ulong mulu()(ulong x, uint y, ref bool overflow)
^
ソースコード
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;
}
}
kokatsu