結果
問題 | No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩 |
ユーザー | kakel-san |
提出日時 | 2024-08-08 22:28:37 |
言語 | C# (.NET 8.0.203) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,107 bytes |
コンパイル時間 | 16,992 ms |
コンパイル使用メモリ | 166,160 KB |
実行使用メモリ | 189,052 KB |
最終ジャッジ日時 | 2024-08-08 22:29:25 |
合計ジャッジ時間 | 42,339 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 59 ms
30,976 KB |
testcase_01 | AC | 59 ms
30,976 KB |
testcase_02 | AC | 56 ms
30,720 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 62 ms
30,956 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | AC | 806 ms
69,372 KB |
testcase_49 | AC | 645 ms
69,632 KB |
testcase_50 | AC | 790 ms
69,632 KB |
testcase_51 | AC | 727 ms
69,504 KB |
testcase_52 | AC | 750 ms
69,632 KB |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | AC | 614 ms
85,008 KB |
testcase_59 | AC | 617 ms
85,264 KB |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | AC | 515 ms
83,584 KB |
testcase_64 | AC | 506 ms
83,840 KB |
testcase_65 | AC | 516 ms
83,452 KB |
testcase_66 | AC | 511 ms
83,584 KB |
testcase_67 | AC | 565 ms
83,452 KB |
testcase_68 | AC | 59 ms
30,844 KB |
testcase_69 | AC | 60 ms
30,976 KB |
testcase_70 | AC | 60 ms
30,716 KB |
testcase_71 | AC | 61 ms
30,976 KB |
testcase_72 | AC | 59 ms
31,232 KB |
testcase_73 | AC | 60 ms
189,052 KB |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (122 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (k, l, m, n, s) = (c[0], c[1], c[2], c[3], c[4]); var a = NList; var b = NList; c = NList; var d = NList; var firstp = new List<(long a, long b, long x)>(); var firstn = new List<(long a, long b, long x)>(); for (var i = 0; i < k; ++i) for (var j = 0; j < l; ++j) { if (a[i] * b[j] >= 0) firstp.Add((a[i], b[j], a[i] * b[j])); else firstn.Add((a[i], b[j], a[i] * b[j])); } var secondp = new List<(long c, long d, long x)>(); var secondn = new List<(long c, long d, long x)>(); for (var i = 0; i < m; ++i) for (var j = 0; j < n; ++j) { if (c[i] * d[j] >= 0) secondp.Add((c[i], d[j], c[i] * d[j])); else secondn.Add((c[i], d[j], c[i] * d[j])); } firstp.Sort((l, r) => l.x.CompareTo(r.x)); firstn.Sort((l, r) => r.x.CompareTo(l.x)); secondp.Sort((l, r) => l.x.CompareTo(r.x)); secondn.Sort((l, r) => r.x.CompareTo(l.x)); var ok = -810_000_000_000_000_000; var ng = 810_000_000_000_000_001; var ans = ""; while (ng - ok > 1) { var sub = ""; var mid = (ok + ng) / 2; // Tよりも小さいABCDの数が S-1 個以下となる最大の数を求める var count = 0L; if (mid < 0) { var cur = 0; for (var i = firstp.Count - 1; i >= 0; --i) { while (cur < secondn.Count && firstp[i].x * secondn[cur].x >= mid) ++cur; count += secondn.Count - cur; if (cur < secondn.Count && firstp[i].x * secondn[cur].x == mid) { sub = $"{firstp[i].a} {firstp[i].b} {secondn[cur].c} {secondn[cur].d}"; } } cur = 0; for (var i = firstn.Count - 1; i >= 0; --i) { while (cur < secondp.Count && firstn[i].x * secondp[cur].x >= mid) ++cur; count += secondp.Count - cur; if (cur < secondp.Count && firstn[i].x * secondp[cur].x == mid) { sub = $"{firstn[i].a} {firstn[i].b} {secondp[cur].c} {secondp[cur].d}"; } } } else { count += (long)firstp.Count * secondn.Count + (long)firstn.Count * secondp.Count; var cur = 0; for (var i = firstp.Count - 1; i >= 0; --i) { while (cur < secondp.Count && firstp[i].x * secondp[cur].x < mid) ++cur; count += cur; if (cur < secondp.Count && firstp[i].x * secondp[cur].x == mid) { sub = $"{firstp[i].a} {firstp[i].b} {secondp[cur].c} {secondp[cur].d}"; } } for (var i = firstn.Count - 1; i >= 0; --i) { while (cur < secondn.Count && firstn[i].x * secondn[cur].x < mid) ++cur; count += cur; if (cur < secondn.Count && firstn[i].x * secondn[cur].x == mid) { sub = $"{firstn[i].a} {firstn[i].b} {secondn[cur].c} {secondn[cur].d}"; } } } if (count <= s - 1) { ok = mid; ans = sub; } else ng = mid; } WriteLine(ok); WriteLine(ans); } }