結果
問題 | No.1355 AND OR GAME |
ユーザー | さかぽん |
提出日時 | 2021-01-24 13:19:52 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,965 bytes |
コンパイル時間 | 2,250 ms |
コンパイル使用メモリ | 109,440 KB |
実行使用メモリ | 161,680 KB |
最終ジャッジ日時 | 2024-06-10 20:11:07 |
合計ジャッジ時間 | 27,821 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 25 ms
19,200 KB |
testcase_01 | AC | 25 ms
18,944 KB |
testcase_02 | AC | 30 ms
20,096 KB |
testcase_03 | AC | 29 ms
19,968 KB |
testcase_04 | AC | 30 ms
19,840 KB |
testcase_05 | AC | 26 ms
19,200 KB |
testcase_06 | AC | 30 ms
19,968 KB |
testcase_07 | AC | 29 ms
19,968 KB |
testcase_08 | AC | 30 ms
19,840 KB |
testcase_09 | AC | 29 ms
19,584 KB |
testcase_10 | AC | 26 ms
19,200 KB |
testcase_11 | AC | 26 ms
19,328 KB |
testcase_12 | AC | 26 ms
19,200 KB |
testcase_13 | AC | 25 ms
18,944 KB |
testcase_14 | AC | 23 ms
18,944 KB |
testcase_15 | AC | 24 ms
18,944 KB |
testcase_16 | AC | 25 ms
19,328 KB |
testcase_17 | AC | 25 ms
19,200 KB |
testcase_18 | AC | 24 ms
19,200 KB |
testcase_19 | AC | 25 ms
18,944 KB |
testcase_20 | AC | 26 ms
19,456 KB |
testcase_21 | AC | 26 ms
18,944 KB |
testcase_22 | AC | 27 ms
19,328 KB |
testcase_23 | AC | 27 ms
19,072 KB |
testcase_24 | AC | 25 ms
18,944 KB |
testcase_25 | AC | 26 ms
19,200 KB |
testcase_26 | AC | 26 ms
19,200 KB |
testcase_27 | AC | 24 ms
19,200 KB |
testcase_28 | AC | 26 ms
19,200 KB |
testcase_29 | AC | 25 ms
19,072 KB |
testcase_30 | AC | 26 ms
19,328 KB |
testcase_31 | AC | 25 ms
19,072 KB |
testcase_32 | AC | 25 ms
19,200 KB |
testcase_33 | AC | 25 ms
19,328 KB |
testcase_34 | AC | 43 ms
22,656 KB |
testcase_35 | AC | 181 ms
50,648 KB |
testcase_36 | AC | 176 ms
49,088 KB |
testcase_37 | AC | 27 ms
19,072 KB |
testcase_38 | AC | 183 ms
50,776 KB |
testcase_39 | AC | 79 ms
35,328 KB |
testcase_40 | AC | 105 ms
40,704 KB |
testcase_41 | AC | 184 ms
50,908 KB |
testcase_42 | AC | 185 ms
50,904 KB |
testcase_43 | AC | 123 ms
43,264 KB |
testcase_44 | AC | 52 ms
24,832 KB |
testcase_45 | AC | 186 ms
50,772 KB |
testcase_46 | AC | 89 ms
36,736 KB |
testcase_47 | AC | 184 ms
50,916 KB |
testcase_48 | AC | 139 ms
44,436 KB |
testcase_49 | AC | 179 ms
50,896 KB |
testcase_50 | AC | 26 ms
19,072 KB |
testcase_51 | AC | 106 ms
40,960 KB |
testcase_52 | AC | 163 ms
48,952 KB |
testcase_53 | AC | 120 ms
42,880 KB |
testcase_54 | AC | 184 ms
51,020 KB |
testcase_55 | AC | 158 ms
49,000 KB |
testcase_56 | AC | 157 ms
48,980 KB |
testcase_57 | AC | 140 ms
44,288 KB |
testcase_58 | AC | 58 ms
26,496 KB |
testcase_59 | AC | 26 ms
19,072 KB |
testcase_60 | AC | 128 ms
43,392 KB |
testcase_61 | AC | 26 ms
19,072 KB |
testcase_62 | AC | 89 ms
37,120 KB |
testcase_63 | AC | 185 ms
50,888 KB |
testcase_64 | AC | 156 ms
49,096 KB |
testcase_65 | AC | 31 ms
19,840 KB |
testcase_66 | AC | 70 ms
34,432 KB |
testcase_67 | AC | 76 ms
34,560 KB |
testcase_68 | AC | 76 ms
34,176 KB |
testcase_69 | AC | 25 ms
19,072 KB |
testcase_70 | AC | 87 ms
36,608 KB |
testcase_71 | AC | 177 ms
50,780 KB |
testcase_72 | AC | 182 ms
50,904 KB |
testcase_73 | AC | 183 ms
51,032 KB |
testcase_74 | AC | 178 ms
51,160 KB |
testcase_75 | AC | 178 ms
50,912 KB |
testcase_76 | AC | 179 ms
51,020 KB |
testcase_77 | AC | 180 ms
50,772 KB |
testcase_78 | AC | 25 ms
18,944 KB |
testcase_79 | AC | 25 ms
19,200 KB |
testcase_80 | AC | 177 ms
51,156 KB |
testcase_81 | AC | 177 ms
51,036 KB |
testcase_82 | AC | 180 ms
51,032 KB |
testcase_83 | AC | 155 ms
48,684 KB |
testcase_84 | AC | 406 ms
70,160 KB |
testcase_85 | AC | 1,346 ms
125,780 KB |
testcase_86 | AC | 780 ms
89,388 KB |
testcase_87 | AC | 601 ms
80,476 KB |
testcase_88 | AC | 63 ms
27,228 KB |
testcase_89 | AC | 44 ms
24,064 KB |
testcase_90 | TLE | - |
testcase_91 | AC | 120 ms
42,604 KB |
testcase_92 | AC | 76 ms
28,644 KB |
testcase_93 | AC | 1,615 ms
137,960 KB |
testcase_94 | AC | 737 ms
91,328 KB |
testcase_95 | AC | 530 ms
73,928 KB |
testcase_96 | AC | 371 ms
63,524 KB |
testcase_97 | AC | 68 ms
28,740 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; return string.Join(" ", p); } }