結果
問題 | No.1355 AND OR GAME |
ユーザー | さかぽん |
提出日時 | 2021-01-24 12:20:41 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,095 bytes |
コンパイル時間 | 3,062 ms |
コンパイル使用メモリ | 109,056 KB |
実行使用メモリ | 156,564 KB |
最終ジャッジ日時 | 2024-06-10 19:32:55 |
合計ジャッジ時間 | 31,413 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
19,072 KB |
testcase_01 | AC | 28 ms
18,944 KB |
testcase_02 | AC | 32 ms
20,096 KB |
testcase_03 | AC | 32 ms
19,968 KB |
testcase_04 | AC | 34 ms
19,968 KB |
testcase_05 | AC | 29 ms
19,200 KB |
testcase_06 | AC | 33 ms
20,224 KB |
testcase_07 | AC | 33 ms
19,968 KB |
testcase_08 | AC | 32 ms
19,968 KB |
testcase_09 | AC | 32 ms
19,712 KB |
testcase_10 | AC | 29 ms
18,944 KB |
testcase_11 | AC | 28 ms
18,816 KB |
testcase_12 | AC | 28 ms
18,944 KB |
testcase_13 | AC | 28 ms
19,072 KB |
testcase_14 | AC | 27 ms
19,072 KB |
testcase_15 | AC | 28 ms
18,816 KB |
testcase_16 | RE | - |
testcase_17 | AC | 28 ms
19,072 KB |
testcase_18 | RE | - |
testcase_19 | AC | 27 ms
18,816 KB |
testcase_20 | AC | 29 ms
19,200 KB |
testcase_21 | AC | 29 ms
18,816 KB |
testcase_22 | AC | 28 ms
19,200 KB |
testcase_23 | AC | 29 ms
19,200 KB |
testcase_24 | AC | 30 ms
19,072 KB |
testcase_25 | AC | 30 ms
19,072 KB |
testcase_26 | AC | 30 ms
18,944 KB |
testcase_27 | AC | 30 ms
19,072 KB |
testcase_28 | AC | 30 ms
19,072 KB |
testcase_29 | AC | 28 ms
18,944 KB |
testcase_30 | AC | 28 ms
18,944 KB |
testcase_31 | AC | 27 ms
19,072 KB |
testcase_32 | AC | 29 ms
18,944 KB |
testcase_33 | AC | 29 ms
19,072 KB |
testcase_34 | RE | - |
testcase_35 | AC | 191 ms
51,540 KB |
testcase_36 | WA | - |
testcase_37 | AC | 29 ms
19,072 KB |
testcase_38 | RE | - |
testcase_39 | AC | 90 ms
35,584 KB |
testcase_40 | AC | 119 ms
40,960 KB |
testcase_41 | AC | 197 ms
51,804 KB |
testcase_42 | WA | - |
testcase_43 | AC | 121 ms
44,980 KB |
testcase_44 | RE | - |
testcase_45 | AC | 197 ms
51,652 KB |
testcase_46 | AC | 95 ms
36,864 KB |
testcase_47 | RE | - |
testcase_48 | AC | 148 ms
45,216 KB |
testcase_49 | WA | - |
testcase_50 | AC | 27 ms
19,072 KB |
testcase_51 | AC | 113 ms
41,472 KB |
testcase_52 | RE | - |
testcase_53 | AC | 131 ms
42,752 KB |
testcase_54 | AC | 195 ms
51,784 KB |
testcase_55 | AC | 167 ms
49,244 KB |
testcase_56 | AC | 160 ms
48,964 KB |
testcase_57 | AC | 143 ms
44,556 KB |
testcase_58 | AC | 62 ms
26,880 KB |
testcase_59 | AC | 29 ms
19,072 KB |
testcase_60 | AC | 142 ms
44,072 KB |
testcase_61 | AC | 29 ms
18,816 KB |
testcase_62 | AC | 100 ms
37,120 KB |
testcase_63 | AC | 201 ms
51,792 KB |
testcase_64 | AC | 167 ms
48,976 KB |
testcase_65 | RE | - |
testcase_66 | AC | 81 ms
34,304 KB |
testcase_67 | AC | 89 ms
34,816 KB |
testcase_68 | RE | - |
testcase_69 | AC | 29 ms
18,944 KB |
testcase_70 | AC | 94 ms
36,992 KB |
testcase_71 | RE | - |
testcase_72 | AC | 199 ms
51,660 KB |
testcase_73 | AC | 196 ms
51,680 KB |
testcase_74 | RE | - |
testcase_75 | RE | - |
testcase_76 | AC | 200 ms
51,792 KB |
testcase_77 | RE | - |
testcase_78 | AC | 29 ms
18,944 KB |
testcase_79 | AC | 28 ms
19,072 KB |
testcase_80 | AC | 197 ms
51,660 KB |
testcase_81 | RE | - |
testcase_82 | RE | - |
testcase_83 | AC | 168 ms
48,680 KB |
testcase_84 | AC | 355 ms
68,496 KB |
testcase_85 | AC | 1,167 ms
120,836 KB |
testcase_86 | AC | 698 ms
87,608 KB |
testcase_87 | AC | 533 ms
80,476 KB |
testcase_88 | AC | 59 ms
28,972 KB |
testcase_89 | AC | 44 ms
23,936 KB |
testcase_90 | AC | 1,769 ms
144,648 KB |
testcase_91 | AC | 111 ms
46,568 KB |
testcase_92 | AC | 73 ms
28,800 KB |
testcase_93 | AC | 1,472 ms
133,868 KB |
testcase_94 | AC | 683 ms
88,900 KB |
testcase_95 | AC | 481 ms
71,332 KB |
testcase_96 | AC | 338 ms
62,900 KB |
testcase_97 | AC | 71 ms
28,116 KB |
testcase_98 | AC | 1,866 ms
156,564 KB |
コンパイルメッセージ
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 & (1 << i)) != 0); bool?[] ToBoolN(long v) => Array.ConvertAll(r60, i => (bool?)((v & (1 << i)) != 0)); bool Matches(bool[] x, bool?[] y) => Array.TrueForAll(r60, i => (x[i] ^ y[i]) != true); 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++) { if (yf[f] == null || (af[f] & null) == yf[f]) { } else if ((af[f] & true) == yf[f]) t[f] = true; else if ((af[f] & false) == yf[f]) 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++) { if (yf[f] == null || (af[f] | null) == yf[f]) { } else if ((af[f] | true) == yf[f]) t[f] = true; else if ((af[f] | false) == yf[f]) 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); } }