結果
問題 | No.1355 AND OR GAME |
ユーザー | さかぽん |
提出日時 | 2021-01-24 16:43:00 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 734 ms / 2,000 ms |
コード長 | 1,806 bytes |
コンパイル時間 | 3,208 ms |
コンパイル使用メモリ | 108,032 KB |
実行使用メモリ | 51,048 KB |
最終ジャッジ日時 | 2024-06-10 23:13:13 |
合計ジャッジ時間 | 23,204 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 25 ms
19,200 KB |
testcase_01 | AC | 27 ms
18,944 KB |
testcase_02 | AC | 31 ms
19,840 KB |
testcase_03 | AC | 30 ms
19,840 KB |
testcase_04 | AC | 30 ms
19,968 KB |
testcase_05 | AC | 26 ms
19,072 KB |
testcase_06 | AC | 30 ms
19,712 KB |
testcase_07 | AC | 31 ms
19,712 KB |
testcase_08 | AC | 30 ms
19,968 KB |
testcase_09 | AC | 30 ms
19,456 KB |
testcase_10 | AC | 26 ms
19,328 KB |
testcase_11 | AC | 26 ms
19,328 KB |
testcase_12 | AC | 26 ms
19,456 KB |
testcase_13 | AC | 27 ms
19,200 KB |
testcase_14 | AC | 28 ms
18,816 KB |
testcase_15 | AC | 30 ms
18,944 KB |
testcase_16 | AC | 28 ms
19,328 KB |
testcase_17 | AC | 26 ms
18,816 KB |
testcase_18 | AC | 25 ms
19,200 KB |
testcase_19 | AC | 23 ms
18,816 KB |
testcase_20 | AC | 25 ms
19,072 KB |
testcase_21 | AC | 26 ms
18,944 KB |
testcase_22 | AC | 25 ms
19,072 KB |
testcase_23 | AC | 25 ms
19,200 KB |
testcase_24 | AC | 25 ms
19,072 KB |
testcase_25 | AC | 26 ms
19,456 KB |
testcase_26 | AC | 25 ms
19,072 KB |
testcase_27 | AC | 26 ms
18,816 KB |
testcase_28 | AC | 25 ms
19,200 KB |
testcase_29 | AC | 25 ms
19,200 KB |
testcase_30 | AC | 25 ms
19,456 KB |
testcase_31 | AC | 26 ms
19,456 KB |
testcase_32 | AC | 25 ms
19,200 KB |
testcase_33 | AC | 27 ms
19,328 KB |
testcase_34 | AC | 77 ms
22,656 KB |
testcase_35 | AC | 177 ms
50,920 KB |
testcase_36 | AC | 170 ms
49,220 KB |
testcase_37 | AC | 26 ms
19,072 KB |
testcase_38 | AC | 174 ms
50,776 KB |
testcase_39 | AC | 77 ms
35,456 KB |
testcase_40 | AC | 102 ms
40,448 KB |
testcase_41 | AC | 180 ms
50,784 KB |
testcase_42 | AC | 178 ms
50,924 KB |
testcase_43 | AC | 130 ms
43,008 KB |
testcase_44 | AC | 51 ms
24,704 KB |
testcase_45 | AC | 198 ms
51,024 KB |
testcase_46 | AC | 96 ms
36,480 KB |
testcase_47 | AC | 180 ms
51,036 KB |
testcase_48 | AC | 136 ms
44,672 KB |
testcase_49 | AC | 181 ms
50,912 KB |
testcase_50 | AC | 25 ms
19,072 KB |
testcase_51 | AC | 105 ms
40,960 KB |
testcase_52 | AC | 163 ms
48,700 KB |
testcase_53 | AC | 121 ms
42,880 KB |
testcase_54 | AC | 177 ms
51,024 KB |
testcase_55 | AC | 152 ms
48,728 KB |
testcase_56 | AC | 150 ms
48,856 KB |
testcase_57 | AC | 135 ms
44,176 KB |
testcase_58 | AC | 57 ms
26,880 KB |
testcase_59 | AC | 25 ms
18,944 KB |
testcase_60 | AC | 128 ms
43,136 KB |
testcase_61 | AC | 26 ms
19,200 KB |
testcase_62 | AC | 87 ms
37,120 KB |
testcase_63 | AC | 174 ms
51,036 KB |
testcase_64 | AC | 150 ms
48,984 KB |
testcase_65 | AC | 30 ms
20,224 KB |
testcase_66 | AC | 70 ms
34,432 KB |
testcase_67 | AC | 77 ms
34,432 KB |
testcase_68 | AC | 80 ms
34,432 KB |
testcase_69 | AC | 27 ms
18,944 KB |
testcase_70 | AC | 89 ms
36,864 KB |
testcase_71 | AC | 179 ms
50,908 KB |
testcase_72 | AC | 177 ms
51,036 KB |
testcase_73 | AC | 184 ms
50,776 KB |
testcase_74 | AC | 176 ms
51,036 KB |
testcase_75 | AC | 178 ms
50,908 KB |
testcase_76 | AC | 175 ms
51,036 KB |
testcase_77 | AC | 174 ms
50,776 KB |
testcase_78 | AC | 25 ms
18,944 KB |
testcase_79 | AC | 24 ms
19,200 KB |
testcase_80 | AC | 176 ms
51,048 KB |
testcase_81 | AC | 179 ms
50,900 KB |
testcase_82 | AC | 177 ms
50,800 KB |
testcase_83 | AC | 150 ms
48,956 KB |
testcase_84 | AC | 245 ms
29,952 KB |
testcase_85 | AC | 588 ms
38,656 KB |
testcase_86 | AC | 376 ms
34,688 KB |
testcase_87 | AC | 326 ms
33,536 KB |
testcase_88 | AC | 55 ms
23,740 KB |
testcase_89 | AC | 48 ms
23,168 KB |
testcase_90 | AC | 733 ms
42,496 KB |
testcase_91 | AC | 105 ms
25,472 KB |
testcase_92 | AC | 63 ms
24,192 KB |
testcase_93 | AC | 612 ms
40,064 KB |
testcase_94 | AC | 364 ms
33,920 KB |
testcase_95 | AC | 267 ms
31,488 KB |
testcase_96 | AC | 216 ms
28,928 KB |
testcase_97 | AC | 61 ms
23,680 KB |
testcase_98 | AC | 734 ms
43,392 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 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 = ToBoolN(x); var yf = ToBoolN(y); for (int i = n - 1; i >= 0; i--) { var af = ToBoolN(a[i]); if (Matches(af, yf)) { p.Push(3); while (p.Count < n) p.Push(1); return string.Join(" ", p); } { var ok = true; var t = new bool?[60]; for (int f = 0; f < 60; f++) { if (Match(af[f] & null, yf[f])) { } else if (Match(af[f] & true, yf[f])) t[f] = true; else if (Match(af[f] & false, yf[f])) t[f] = false; else { ok = false; break; } } if (ok) { p.Push(1); yf = t; continue; } } { var ok = true; var t = new bool?[60]; for (int f = 0; f < 60; f++) { if (Match(af[f] | null, yf[f])) { } else if (Match(af[f] | true, yf[f])) t[f] = true; else if (Match(af[f] | false, yf[f])) t[f] = false; else { ok = false; break; } } if (ok) { p.Push(2); yf = t; continue; } } return -1; } if (!Matches(xf, yf)) return -1; return string.Join(" ", p); } }