結果
問題 | No.1935 Water Simulation |
ユーザー | 👑 hos.lyric |
提出日時 | 2022-05-13 22:09:30 |
言語 | D (dmd 2.106.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,125 bytes |
コンパイル時間 | 668 ms |
コンパイル使用メモリ | 107,792 KB |
実行使用メモリ | 227,812 KB |
最終ジャッジ日時 | 2023-09-04 17:06:39 |
合計ジャッジ時間 | 3,279 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 29 ms
40,376 KB |
testcase_05 | AC | 138 ms
149,064 KB |
testcase_06 | AC | 9 ms
6,144 KB |
testcase_07 | AC | 5 ms
6,480 KB |
testcase_08 | AC | 68 ms
97,748 KB |
testcase_09 | AC | 121 ms
134,012 KB |
testcase_10 | AC | 71 ms
82,720 KB |
testcase_11 | AC | 7 ms
7,228 KB |
testcase_12 | AC | 9 ms
13,728 KB |
testcase_13 | AC | 4 ms
4,656 KB |
testcase_14 | AC | 76 ms
92,024 KB |
testcase_15 | AC | 35 ms
40,992 KB |
testcase_16 | AC | 52 ms
55,236 KB |
testcase_17 | AC | 25 ms
38,968 KB |
testcase_18 | AC | 7 ms
8,380 KB |
testcase_19 | AC | 36 ms
42,944 KB |
testcase_20 | AC | 12 ms
9,344 KB |
testcase_21 | AC | 68 ms
115,848 KB |
testcase_22 | AC | 15 ms
18,072 KB |
testcase_23 | AC | 109 ms
159,916 KB |
testcase_24 | AC | 183 ms
227,812 KB |
testcase_25 | AC | 5 ms
4,384 KB |
testcase_26 | AC | 6 ms
7,424 KB |
testcase_27 | AC | 29 ms
37,256 KB |
testcase_28 | AC | 26 ms
20,392 KB |
testcase_29 | AC | 1 ms
4,376 KB |
testcase_30 | AC | 2 ms
4,376 KB |
testcase_31 | AC | 16 ms
14,488 KB |
ソースコード
import std.conv, std.functional, std.range, std.stdio, std.string; import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons; import core.bitop; class EOFException : Throwable { this() { super("EOF"); } } string[] tokens; string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; } int readInt() { return readToken.to!int; } long readLong() { return readToken.to!long; } real readReal() { return readToken.to!real; } bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } } bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } } int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; } int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); } int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); } void main() { try { for (; ; ) { int[4] V; foreach (i; 0 .. 4) { V[i] = readInt; } const N = readLong; int[4][] vss; vss ~= [-1, -1, -1, -1]; auto app = new int[][][][](V[0] + 1, V[1] + 1, V[2] + 1, V[3] + 1); int[4] vs; vs[0] = V[0]; foreach (i; 1 .. N + 1) { debug { writeln(i, " ", vs); } const j = app[vs[0]][vs[1]][vs[2]][vs[3]]; if (j) { vs = vss[cast(int)(j + ((N + 1) - j) % (i - j))]; break; } vss ~= vs; app[vs[0]][vs[1]][vs[2]][vs[3]] = cast(int)(i); auto ws = vs; const j0 = cast(int)((i - 1) & 3); const j1 = cast(int)(i & 3); ws[j1] = min(vs[j0] + vs[j1], V[j1]); ws[j0] = vs[j0] + vs[j1] - ws[j1]; vs = ws; } writeln(vs[0], " ", vs[1], " ", vs[2], " ", vs[3]); } } catch (EOFException e) { } }