結果
問題 | No.885 アマリクエリ |
ユーザー | nebukuro09 |
提出日時 | 2019-09-15 00:04:47 |
言語 | D (dmd 2.105.2) |
結果 |
AC
|
実行時間 | 599 ms / 2,000 ms |
コード長 | 711 bytes |
コンパイル時間 | 1,132 ms |
コンパイル使用メモリ | 117,732 KB |
実行使用メモリ | 12,608 KB |
最終ジャッジ日時 | 2023-09-04 02:47:15 |
合計ジャッジ時間 | 4,623 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 599 ms
12,608 KB |
testcase_01 | AC | 217 ms
10,808 KB |
testcase_02 | AC | 90 ms
11,032 KB |
testcase_03 | AC | 86 ms
12,204 KB |
testcase_04 | AC | 90 ms
11,940 KB |
testcase_05 | AC | 57 ms
11,332 KB |
testcase_06 | AC | 44 ms
11,104 KB |
testcase_07 | AC | 21 ms
8,276 KB |
testcase_08 | AC | 43 ms
6,164 KB |
testcase_09 | AC | 219 ms
11,860 KB |
testcase_10 | AC | 1 ms
4,380 KB |
testcase_11 | AC | 1 ms
4,376 KB |
testcase_12 | AC | 1 ms
4,380 KB |
testcase_13 | AC | 2 ms
4,380 KB |
testcase_14 | AC | 3 ms
4,376 KB |
testcase_15 | AC | 3 ms
4,376 KB |
testcase_16 | AC | 3 ms
4,376 KB |
testcase_17 | AC | 2 ms
4,376 KB |
testcase_18 | AC | 3 ms
4,376 KB |
testcase_19 | AC | 1 ms
4,376 KB |
testcase_20 | AC | 2 ms
4,376 KB |
testcase_21 | AC | 2 ms
4,376 KB |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdio; void main() { auto N = readln.chomp.to!int; auto A = readln.split.map!(to!long).array; auto Q = readln.chomp.to!int; auto B = readln.split.map!(to!long).array; auto pq = new BinaryHeap!(Array!long, "a < b"); foreach (a; A) pq.insert(a); long ans = A.sum; foreach (b; B) { while (pq.front >= b) { long v = pq.front; pq.removeFront; ans -= v; ans += v % b; pq.insert(v % b); } ans.writeln; } }