結果
問題 | No.1355 AND OR GAME |
ユーザー | さかぽん |
提出日時 | 2021-01-24 13:27:45 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 1,752 ms / 2,000 ms |
コード長 | 1,891 bytes |
コンパイル時間 | 1,224 ms |
コンパイル使用メモリ | 109,184 KB |
実行使用メモリ | 157,080 KB |
最終ジャッジ日時 | 2024-06-10 20:19:46 |
合計ジャッジ時間 | 24,567 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 25 ms
19,328 KB |
testcase_01 | AC | 25 ms
19,072 KB |
testcase_02 | AC | 31 ms
19,968 KB |
testcase_03 | AC | 32 ms
19,840 KB |
testcase_04 | AC | 30 ms
19,840 KB |
testcase_05 | AC | 26 ms
19,200 KB |
testcase_06 | AC | 31 ms
19,840 KB |
testcase_07 | AC | 31 ms
19,840 KB |
testcase_08 | AC | 30 ms
19,968 KB |
testcase_09 | AC | 30 ms
19,584 KB |
testcase_10 | AC | 27 ms
19,200 KB |
testcase_11 | AC | 27 ms
19,200 KB |
testcase_12 | AC | 27 ms
19,328 KB |
testcase_13 | AC | 24 ms
19,200 KB |
testcase_14 | AC | 25 ms
19,072 KB |
testcase_15 | AC | 25 ms
19,200 KB |
testcase_16 | AC | 25 ms
19,328 KB |
testcase_17 | AC | 26 ms
19,200 KB |
testcase_18 | AC | 25 ms
19,200 KB |
testcase_19 | AC | 25 ms
19,072 KB |
testcase_20 | AC | 26 ms
19,200 KB |
testcase_21 | AC | 27 ms
19,328 KB |
testcase_22 | AC | 27 ms
19,200 KB |
testcase_23 | AC | 26 ms
19,328 KB |
testcase_24 | AC | 28 ms
19,072 KB |
testcase_25 | AC | 27 ms
19,200 KB |
testcase_26 | AC | 28 ms
19,200 KB |
testcase_27 | AC | 25 ms
19,200 KB |
testcase_28 | AC | 26 ms
19,328 KB |
testcase_29 | AC | 26 ms
19,328 KB |
testcase_30 | AC | 26 ms
19,200 KB |
testcase_31 | AC | 25 ms
19,328 KB |
testcase_32 | AC | 28 ms
19,072 KB |
testcase_33 | AC | 29 ms
19,328 KB |
testcase_34 | AC | 46 ms
23,040 KB |
testcase_35 | AC | 185 ms
51,172 KB |
testcase_36 | AC | 167 ms
49,084 KB |
testcase_37 | AC | 27 ms
18,944 KB |
testcase_38 | AC | 185 ms
51,020 KB |
testcase_39 | AC | 79 ms
35,712 KB |
testcase_40 | AC | 103 ms
40,704 KB |
testcase_41 | AC | 182 ms
51,016 KB |
testcase_42 | AC | 185 ms
51,164 KB |
testcase_43 | AC | 118 ms
43,008 KB |
testcase_44 | AC | 53 ms
24,832 KB |
testcase_45 | AC | 190 ms
50,776 KB |
testcase_46 | AC | 88 ms
36,736 KB |
testcase_47 | AC | 195 ms
51,172 KB |
testcase_48 | AC | 148 ms
44,688 KB |
testcase_49 | AC | 182 ms
50,896 KB |
testcase_50 | AC | 27 ms
19,200 KB |
testcase_51 | AC | 114 ms
41,088 KB |
testcase_52 | AC | 168 ms
48,816 KB |
testcase_53 | AC | 122 ms
43,008 KB |
testcase_54 | AC | 181 ms
51,152 KB |
testcase_55 | AC | 155 ms
48,984 KB |
testcase_56 | AC | 157 ms
49,232 KB |
testcase_57 | AC | 138 ms
44,192 KB |
testcase_58 | AC | 58 ms
26,624 KB |
testcase_59 | AC | 25 ms
19,200 KB |
testcase_60 | AC | 132 ms
43,264 KB |
testcase_61 | AC | 25 ms
18,944 KB |
testcase_62 | AC | 92 ms
37,120 KB |
testcase_63 | AC | 190 ms
51,036 KB |
testcase_64 | AC | 153 ms
49,100 KB |
testcase_65 | AC | 33 ms
19,968 KB |
testcase_66 | AC | 77 ms
34,432 KB |
testcase_67 | AC | 84 ms
34,432 KB |
testcase_68 | AC | 85 ms
34,560 KB |
testcase_69 | AC | 26 ms
18,944 KB |
testcase_70 | AC | 94 ms
36,992 KB |
testcase_71 | AC | 192 ms
51,288 KB |
testcase_72 | AC | 191 ms
51,024 KB |
testcase_73 | AC | 197 ms
50,908 KB |
testcase_74 | AC | 189 ms
51,012 KB |
testcase_75 | AC | 191 ms
51,036 KB |
testcase_76 | AC | 191 ms
51,160 KB |
testcase_77 | AC | 178 ms
51,168 KB |
testcase_78 | AC | 24 ms
18,816 KB |
testcase_79 | AC | 25 ms
19,200 KB |
testcase_80 | AC | 177 ms
51,168 KB |
testcase_81 | AC | 190 ms
51,040 KB |
testcase_82 | AC | 194 ms
50,908 KB |
testcase_83 | AC | 157 ms
49,076 KB |
testcase_84 | AC | 328 ms
68,764 KB |
testcase_85 | AC | 1,086 ms
121,100 KB |
testcase_86 | AC | 636 ms
85,128 KB |
testcase_87 | AC | 484 ms
78,264 KB |
testcase_88 | AC | 55 ms
26,844 KB |
testcase_89 | AC | 38 ms
23,936 KB |
testcase_90 | AC | 1,686 ms
142,880 KB |
testcase_91 | AC | 106 ms
42,240 KB |
testcase_92 | AC | 66 ms
28,544 KB |
testcase_93 | AC | 1,329 ms
133,880 KB |
testcase_94 | AC | 628 ms
89,168 KB |
testcase_95 | AC | 432 ms
71,444 KB |
testcase_96 | AC | 307 ms
62,912 KB |
testcase_97 | AC | 63 ms
28,252 KB |
testcase_98 | AC | 1,752 ms
157,080 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 & (1L << i)) != 0); bool?[] ToBoolN(long v) => Array.ConvertAll(r60, i => (bool?)((v & (1L << 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; return string.Join(" ", p); } }