結果
問題 | No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩 |
ユーザー | kakel-san |
提出日時 | 2024-08-08 23:16:54 |
言語 | C# (.NET 8.0.203) |
結果 |
WA
|
実行時間 | - |
コード長 | 5,060 bytes |
コンパイル時間 | 7,729 ms |
コンパイル使用メモリ | 169,116 KB |
実行使用メモリ | 188,480 KB |
最終ジャッジ日時 | 2024-08-08 23:17:36 |
合計ジャッジ時間 | 36,087 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 54 ms
31,616 KB |
testcase_01 | AC | 55 ms
32,000 KB |
testcase_02 | AC | 54 ms
31,316 KB |
testcase_03 | AC | 56 ms
31,096 KB |
testcase_04 | AC | 56 ms
31,488 KB |
testcase_05 | AC | 55 ms
31,316 KB |
testcase_06 | AC | 55 ms
31,744 KB |
testcase_07 | AC | 55 ms
31,616 KB |
testcase_08 | AC | 66 ms
33,920 KB |
testcase_09 | AC | 64 ms
34,048 KB |
testcase_10 | AC | 68 ms
34,176 KB |
testcase_11 | AC | 63 ms
34,048 KB |
testcase_12 | AC | 69 ms
34,176 KB |
testcase_13 | AC | 67 ms
34,048 KB |
testcase_14 | AC | 63 ms
34,176 KB |
testcase_15 | AC | 81 ms
34,560 KB |
testcase_16 | AC | 66 ms
33,920 KB |
testcase_17 | AC | 76 ms
34,304 KB |
testcase_18 | AC | 121 ms
36,352 KB |
testcase_19 | AC | 84 ms
34,808 KB |
testcase_20 | AC | 106 ms
36,216 KB |
testcase_21 | AC | 86 ms
35,968 KB |
testcase_22 | AC | 89 ms
35,712 KB |
testcase_23 | AC | 102 ms
36,736 KB |
testcase_24 | AC | 103 ms
36,608 KB |
testcase_25 | AC | 99 ms
36,480 KB |
testcase_26 | AC | 122 ms
36,600 KB |
testcase_27 | AC | 91 ms
35,840 KB |
testcase_28 | AC | 360 ms
52,044 KB |
testcase_29 | AC | 319 ms
44,672 KB |
testcase_30 | AC | 316 ms
43,904 KB |
testcase_31 | AC | 364 ms
51,076 KB |
testcase_32 | AC | 430 ms
63,356 KB |
testcase_33 | AC | 302 ms
43,904 KB |
testcase_34 | AC | 442 ms
53,320 KB |
testcase_35 | AC | 440 ms
51,884 KB |
testcase_36 | AC | 669 ms
63,908 KB |
testcase_37 | AC | 228 ms
42,492 KB |
testcase_38 | AC | 384 ms
46,644 KB |
testcase_39 | AC | 246 ms
43,520 KB |
testcase_40 | AC | 297 ms
44,672 KB |
testcase_41 | AC | 403 ms
50,244 KB |
testcase_42 | AC | 591 ms
64,776 KB |
testcase_43 | AC | 389 ms
52,156 KB |
testcase_44 | AC | 492 ms
51,776 KB |
testcase_45 | AC | 379 ms
47,000 KB |
testcase_46 | AC | 474 ms
52,344 KB |
testcase_47 | AC | 271 ms
44,416 KB |
testcase_48 | AC | 692 ms
76,128 KB |
testcase_49 | AC | 580 ms
76,008 KB |
testcase_50 | AC | 718 ms
76,256 KB |
testcase_51 | AC | 623 ms
76,268 KB |
testcase_52 | AC | 677 ms
76,140 KB |
testcase_53 | AC | 836 ms
72,056 KB |
testcase_54 | AC | 821 ms
71,772 KB |
testcase_55 | AC | 923 ms
73,940 KB |
testcase_56 | AC | 836 ms
72,064 KB |
testcase_57 | AC | 667 ms
78,440 KB |
testcase_58 | AC | 576 ms
94,848 KB |
testcase_59 | AC | 559 ms
94,840 KB |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | AC | 80 ms
57,924 KB |
testcase_64 | AC | 80 ms
61,900 KB |
testcase_65 | AC | 83 ms
61,904 KB |
testcase_66 | AC | 80 ms
61,720 KB |
testcase_67 | AC | 79 ms
61,736 KB |
testcase_68 | AC | 61 ms
31,100 KB |
testcase_69 | AC | 57 ms
31,356 KB |
testcase_70 | AC | 54 ms
31,232 KB |
testcase_71 | AC | 57 ms
31,104 KB |
testcase_72 | AC | 59 ms
31,104 KB |
testcase_73 | AC | 54 ms
188,480 KB |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (93 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 q = Qua(k, l, m, n, s, a, b, c, d); WriteLine(q.t); WriteLine(q.ans); } static (long t, string ans) Qua(long k, long l, long m, long n, long s, long[] a, long[] b, long[] c, long[] d) { var firstp = new List<(long a, long b, long x)>(); var firstn = new List<(long a, long b, long x)>(); var firstz = new List<(long a, long b)>(); 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 if (a[i] * b[j] < 0) firstn.Add((a[i], b[j], a[i] * b[j])); else firstz.Add((a[i], b[j])); } var secondp = new List<(long c, long d, long x)>(); var secondn = new List<(long c, long d, long x)>(); var secondz = new List<(long c, long d)>(); 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 if (c[i] * d[j] < 0) secondn.Add((c[i], d[j], c[i] * d[j])); else secondz.Add((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 = secondn.Count - 1; for (var i = 0; i < firstp.Count; ++i) { while (cur >= 0 && firstp[i].x * secondn[cur].x < mid) --cur; count += secondn.Count - 1 - cur; if (cur >= 0 && firstp[i].x * secondn[cur].x == mid) { sub = $"{firstp[i].a} {firstp[i].b} {secondn[cur].c} {secondn[cur].d}"; } } cur = secondp.Count - 1; for (var i = 0; i < firstn.Count; ++i) { while (cur >= 0 && firstn[i].x * secondp[cur].x < mid) --cur; count += secondp.Count - 1 - cur; if (cur >= 0 && firstn[i].x * secondp[cur].x == mid) { sub = $"{firstn[i].a} {firstn[i].b} {secondp[cur].c} {secondp[cur].d}"; } } } else if (mid > 0) { count += firstp.Count * ((long)secondn.Count + secondz.Count) + firstn.Count * ((long)secondp.Count + secondz.Count) + firstz.Count * ((long)secondp.Count + secondn.Count + secondz.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}"; } } cur = 0; 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}"; } } } else { count += (long)firstp.Count * secondn.Count + (long)firstn.Count * secondp.Count; if (firstz.Count > 0) sub = $"{firstz[0].a} {firstz[0].b} {c[0]} {d[0]}"; else if (secondz.Count > 0) sub = $"{a[0]} {b[0]} {secondz[0].c} {secondz[0].d}"; } if (count <= s - 1) { ok = mid; ans = sub; } else ng = mid; } return (ok, ans); } }