結果
問題 |
No.3068 Speedrun (Hard)
|
ユーザー |
|
提出日時 | 2025-03-21 22:03:15 |
言語 | D (dmd 2.109.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,363 bytes |
コンパイル時間 | 3,552 ms |
コンパイル使用メモリ | 164,416 KB |
実行使用メモリ | 10,012 KB |
最終ジャッジ日時 | 2025-03-21 22:03:23 |
合計ジャッジ時間 | 6,814 ms |
ジャッジサーバーID (参考情報) |
judge7 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 2 TLE * 1 -- * 29 |
ソースコード
import std; void main () { auto A = readln.split.to!(int[]); auto T = readln.split.to!(int[]); int N = A[$ - 1]; // 解いた数を持つdpだと状態数デカすぎるから厳しい // 半分全列挙できそう? // -> 一気に列挙すると死ぬので消費した問題数ごとに分けて探索する。 Tuple!(int, int)[Tuple!(int, int)] mp; foreach (pre; 0 .. N + 1) { mp.clear; foreach (i; 0 .. A[0] + 1) { int j = pre - i; if (A[1] < j) continue; if (j < 0) break; int time = i * T[0] + j * T[1]; mp[tuple(time, pre)] = tuple(i, j); } int aft = N - pre; foreach (i; 0 .. A[2] + 1) { int j = aft - i; if (A[3] < j) continue; if (j < 0) break; int rem_time = T[$ - 1] - (i * T[2] + j * T[3]); int rem_count = N - (i + j); if (tuple(rem_time, rem_count) in mp) { auto v = mp[tuple(rem_time, rem_count)]; writeln(v[0], " ", v[1], " ", i, " ", j); return; } } } } void read (T...) (string S, ref T args) { import std.conv : to; import std.array : split; auto buf = S.split; foreach (i, ref arg; args) { arg = buf[i].to!(typeof(arg)); } }