結果
問題 | No.1355 AND OR GAME |
ユーザー | さかぽん |
提出日時 | 2021-01-24 13:06:17 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,171 bytes |
コンパイル時間 | 941 ms |
コンパイル使用メモリ | 108,928 KB |
実行使用メモリ | 161,688 KB |
最終ジャッジ日時 | 2024-06-10 19:58:45 |
合計ジャッジ時間 | 28,981 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
18,944 KB |
testcase_01 | AC | 29 ms
19,072 KB |
testcase_02 | AC | 34 ms
19,456 KB |
testcase_03 | AC | 36 ms
19,712 KB |
testcase_04 | AC | 34 ms
19,840 KB |
testcase_05 | AC | 29 ms
18,944 KB |
testcase_06 | AC | 35 ms
20,224 KB |
testcase_07 | AC | 35 ms
19,584 KB |
testcase_08 | AC | 34 ms
20,096 KB |
testcase_09 | AC | 33 ms
19,584 KB |
testcase_10 | AC | 30 ms
19,200 KB |
testcase_11 | AC | 29 ms
19,200 KB |
testcase_12 | AC | 29 ms
19,328 KB |
testcase_13 | AC | 28 ms
19,200 KB |
testcase_14 | AC | 27 ms
19,200 KB |
testcase_15 | AC | 29 ms
19,200 KB |
testcase_16 | AC | 30 ms
19,200 KB |
testcase_17 | AC | 29 ms
19,200 KB |
testcase_18 | AC | 29 ms
18,944 KB |
testcase_19 | AC | 27 ms
19,200 KB |
testcase_20 | AC | 30 ms
19,200 KB |
testcase_21 | AC | 30 ms
19,200 KB |
testcase_22 | AC | 30 ms
19,072 KB |
testcase_23 | AC | 30 ms
19,200 KB |
testcase_24 | AC | 29 ms
19,200 KB |
testcase_25 | AC | 30 ms
18,944 KB |
testcase_26 | AC | 29 ms
18,944 KB |
testcase_27 | AC | 28 ms
18,944 KB |
testcase_28 | AC | 30 ms
19,072 KB |
testcase_29 | AC | 30 ms
19,328 KB |
testcase_30 | AC | 29 ms
19,328 KB |
testcase_31 | AC | 30 ms
19,200 KB |
testcase_32 | AC | 30 ms
19,072 KB |
testcase_33 | AC | 29 ms
19,200 KB |
testcase_34 | AC | 49 ms
22,912 KB |
testcase_35 | AC | 195 ms
51,680 KB |
testcase_36 | AC | 186 ms
49,476 KB |
testcase_37 | AC | 29 ms
19,072 KB |
testcase_38 | AC | 202 ms
51,664 KB |
testcase_39 | AC | 85 ms
35,584 KB |
testcase_40 | AC | 111 ms
40,832 KB |
testcase_41 | AC | 198 ms
51,536 KB |
testcase_42 | AC | 195 ms
51,540 KB |
testcase_43 | AC | 123 ms
43,136 KB |
testcase_44 | AC | 57 ms
24,448 KB |
testcase_45 | AC | 207 ms
51,524 KB |
testcase_46 | AC | 95 ms
36,864 KB |
testcase_47 | AC | 202 ms
51,284 KB |
testcase_48 | AC | 157 ms
45,320 KB |
testcase_49 | AC | 201 ms
51,396 KB |
testcase_50 | AC | 28 ms
19,072 KB |
testcase_51 | AC | 117 ms
41,344 KB |
testcase_52 | AC | 179 ms
49,580 KB |
testcase_53 | AC | 133 ms
42,880 KB |
testcase_54 | AC | 198 ms
51,532 KB |
testcase_55 | AC | 170 ms
49,104 KB |
testcase_56 | AC | 167 ms
49,092 KB |
testcase_57 | AC | 151 ms
44,820 KB |
testcase_58 | AC | 62 ms
26,880 KB |
testcase_59 | AC | 27 ms
18,944 KB |
testcase_60 | AC | 142 ms
43,952 KB |
testcase_61 | AC | 28 ms
19,072 KB |
testcase_62 | AC | 93 ms
37,120 KB |
testcase_63 | AC | 201 ms
51,524 KB |
testcase_64 | AC | 168 ms
48,840 KB |
testcase_65 | AC | 33 ms
19,584 KB |
testcase_66 | AC | 78 ms
34,432 KB |
testcase_67 | AC | 88 ms
34,560 KB |
testcase_68 | AC | 86 ms
34,560 KB |
testcase_69 | AC | 29 ms
19,072 KB |
testcase_70 | AC | 97 ms
37,120 KB |
testcase_71 | AC | 198 ms
51,644 KB |
testcase_72 | AC | 207 ms
51,672 KB |
testcase_73 | AC | 197 ms
51,548 KB |
testcase_74 | AC | 196 ms
51,388 KB |
testcase_75 | AC | 196 ms
51,412 KB |
testcase_76 | AC | 201 ms
51,664 KB |
testcase_77 | AC | 195 ms
51,552 KB |
testcase_78 | AC | 28 ms
18,944 KB |
testcase_79 | AC | 28 ms
18,816 KB |
testcase_80 | AC | 198 ms
51,420 KB |
testcase_81 | AC | 201 ms
51,680 KB |
testcase_82 | AC | 199 ms
51,404 KB |
testcase_83 | AC | 164 ms
48,544 KB |
testcase_84 | AC | 442 ms
69,664 KB |
testcase_85 | AC | 1,450 ms
125,964 KB |
testcase_86 | AC | 866 ms
89,260 KB |
testcase_87 | AC | 644 ms
80,348 KB |
testcase_88 | AC | 69 ms
27,092 KB |
testcase_89 | AC | 46 ms
23,808 KB |
testcase_90 | TLE | - |
testcase_91 | AC | 129 ms
42,608 KB |
testcase_92 | AC | 81 ms
28,776 KB |
testcase_93 | AC | 1,730 ms
138,196 KB |
testcase_94 | AC | 833 ms
91,708 KB |
testcase_95 | AC | 574 ms
73,936 KB |
testcase_96 | AC | 401 ms
63,516 KB |
testcase_97 | AC | 79 ms
28,492 KB |
testcase_98 | TLE | - |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; class F { static long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse); static (long, long, long) Read3L() { var a = ReadL(); return (a[0], a[1], a[2]); } static void Main() => Console.WriteLine(Solve()); static object Solve() { var (n, x, y) = ((int, long, long))Read3L(); var a = ReadL(); var r60 = Enumerable.Range(0, 60).ToArray(); bool[] ToBool(long v) => Array.ConvertAll(r60, i => (v & (1L << i)) != 0); bool?[] ToBoolN(long v) => Array.ConvertAll(r60, i => (bool?)((v & (1L << i)) != 0)); bool Match(bool x, bool? y) => y == null || x == y; bool Matches(bool[] x, bool?[] y) => Array.TrueForAll(r60, i => Match(x[i], y[i])); var p = new Stack<int>(); var xf = ToBool(x); bool Dfs(int i, bool?[] yf) { if (i < 0) { return Matches(xf, yf); } else { var af = ToBool(a[i]); if (Matches(af, yf)) { p.Push(3); while (p.Count < n) p.Push(1); return true; } { var ok = true; var t = new bool?[60]; for (int f = 0; f < 60; f++) { var mt = Match(af[f] & true, yf[f]); var mf = Match(af[f] & false, yf[f]); if (mt && mf) { } else if (mt) t[f] = true; else if (mf) t[f] = false; else { ok = false; break; } } if (ok) { p.Push(1); if (Dfs(i - 1, t)) return true; p.Pop(); } } { var ok = true; var t = new bool?[60]; for (int f = 0; f < 60; f++) { var mt = Match(af[f] | true, yf[f]); var mf = Match(af[f] | false, yf[f]); if (mt && mf) { } else if (mt) t[f] = true; else if (mf) t[f] = false; else { ok = false; break; } } if (ok) { p.Push(2); if (Dfs(i - 1, t)) return true; p.Pop(); } } return false; } } if (!Dfs(n - 1, ToBoolN(y))) return -1; { var pa = p.ToArray(); for (int i = 0; i < n; i++) if (pa[i] == 1) x &= a[i]; else if (pa[i] == 2) x |= a[i]; else x = a[i]; if (x != y) throw new InvalidOperationException(); } return string.Join(" ", p); } }