結果
問題 | No.33 アメーバがたくさん |
ユーザー | te-sh |
提出日時 | 2016-09-02 01:05:39 |
言語 | D (dmd 2.105.2) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 856 bytes |
コンパイル時間 | 1,057 ms |
コンパイル使用メモリ | 112,712 KB |
実行使用メモリ | 4,372 KB |
最終ジャッジ日時 | 2023-09-02 21:52:23 |
合計ジャッジ時間 | 1,994 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,368 KB |
testcase_01 | AC | 1 ms
4,372 KB |
testcase_02 | AC | 1 ms
4,372 KB |
testcase_03 | AC | 1 ms
4,368 KB |
testcase_04 | AC | 1 ms
4,368 KB |
testcase_05 | AC | 1 ms
4,372 KB |
testcase_06 | AC | 1 ms
4,368 KB |
testcase_07 | AC | 1 ms
4,372 KB |
testcase_08 | AC | 1 ms
4,372 KB |
testcase_09 | AC | 1 ms
4,368 KB |
testcase_10 | AC | 2 ms
4,368 KB |
ソースコード
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); }