結果
問題 | No.33 アメーバがたくさん |
ユーザー |
|
提出日時 | 2016-09-02 01:05:39 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 856 bytes |
コンパイル時間 | 898 ms |
コンパイル使用メモリ | 125,032 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-12 04:07:37 |
合計ジャッジ時間 | 1,458 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
import std.algorithm, std.array, std.container, std.range, std.bitmanip; import std.numeric, std.math, std.bigint, std.random; import std.string, std.conv, std.stdio, std.typecons; struct range { long s; long e; } void main() { auto rd = readln.split.map!(to!long); auto n = rd[0], d = rd[1], t = rd[2]; auto xi = readln.split.map!(to!long).array; xi.sort(); long[][long] aij; foreach (x; xi) { if (x % d == 0 || x >= 0) aij[x % d] ~= x / d; else aij[x % d + d] ~= x / d - 1; } auto bij = aij.values; auto cij = bij.map!((bi) { range[] di; foreach (b; bi) { auto e = range(b - t, b + t); if (di.empty || di.back.e < e.s) di ~= e; else di.back.e = e.e; } return di; }).array; auto r = cij.map!(ci => ci.map!(c => c.e - c.s + 1).sum).sum; writeln(r); }