結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-11-02 17:17:59 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 938 ms / 5,000 ms |
| コード長 | 813 bytes |
| コンパイル時間 | 821 ms |
| コンパイル使用メモリ | 112,896 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 04:53:56 |
| 合計ジャッジ時間 | 9,920 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import std.container;
void main() {
int N = readln().chomp.to!int;
//auto C = readln().split.map!(to!int).array.heapify!"a > b";
auto C = readln().split.map!(to!int);
auto B = readln().split.map!(to!int).array;
int ans = int.max;
foreach (i; iota(N)) {
int m = 0;
Tuple!(int, int)[] D = new Tuple!(int, int)[](N);
foreach (k; iota(N))
D[k] = tuple(C[k], 0);
auto A = D.heapify!"a > b";
foreach (j; iota(N)) {
Tuple!(int, int) top = A.front;
A.removeFront;
A.insert(tuple(top[0]+B[(i+j)%N]/2, top[1]+1));
}
foreach(a; A.take(N))
if (a[1] > m)
m = a[1];
ans = min(ans, m);
}
writeln(ans);
}