結果
問題 | No.1355 AND OR GAME |
ユーザー | さかぽん |
提出日時 | 2021-01-24 17:41:26 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 300 ms / 2,000 ms |
コード長 | 1,612 bytes |
コンパイル時間 | 1,225 ms |
コンパイル使用メモリ | 109,112 KB |
実行使用メモリ | 51,032 KB |
最終ジャッジ日時 | 2024-06-11 00:32:59 |
合計ジャッジ時間 | 20,093 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 30 ms
19,200 KB |
testcase_01 | AC | 30 ms
18,816 KB |
testcase_02 | AC | 34 ms
19,840 KB |
testcase_03 | AC | 34 ms
19,712 KB |
testcase_04 | AC | 36 ms
19,968 KB |
testcase_05 | AC | 31 ms
19,072 KB |
testcase_06 | AC | 34 ms
19,712 KB |
testcase_07 | AC | 34 ms
19,968 KB |
testcase_08 | AC | 34 ms
19,712 KB |
testcase_09 | AC | 34 ms
19,584 KB |
testcase_10 | AC | 29 ms
19,328 KB |
testcase_11 | AC | 29 ms
18,944 KB |
testcase_12 | AC | 29 ms
19,072 KB |
testcase_13 | AC | 27 ms
18,944 KB |
testcase_14 | AC | 28 ms
19,072 KB |
testcase_15 | AC | 29 ms
18,944 KB |
testcase_16 | AC | 30 ms
19,072 KB |
testcase_17 | AC | 29 ms
18,944 KB |
testcase_18 | AC | 29 ms
19,328 KB |
testcase_19 | AC | 28 ms
18,816 KB |
testcase_20 | AC | 29 ms
19,200 KB |
testcase_21 | AC | 29 ms
19,456 KB |
testcase_22 | AC | 30 ms
19,072 KB |
testcase_23 | AC | 29 ms
19,072 KB |
testcase_24 | AC | 29 ms
18,944 KB |
testcase_25 | AC | 29 ms
19,456 KB |
testcase_26 | AC | 29 ms
19,328 KB |
testcase_27 | AC | 28 ms
18,688 KB |
testcase_28 | AC | 28 ms
18,944 KB |
testcase_29 | AC | 29 ms
19,072 KB |
testcase_30 | AC | 29 ms
19,200 KB |
testcase_31 | AC | 28 ms
19,072 KB |
testcase_32 | AC | 28 ms
19,072 KB |
testcase_33 | AC | 29 ms
19,328 KB |
testcase_34 | AC | 49 ms
22,784 KB |
testcase_35 | AC | 203 ms
50,900 KB |
testcase_36 | AC | 187 ms
49,220 KB |
testcase_37 | AC | 29 ms
18,944 KB |
testcase_38 | AC | 200 ms
50,900 KB |
testcase_39 | AC | 89 ms
35,456 KB |
testcase_40 | AC | 115 ms
40,320 KB |
testcase_41 | AC | 199 ms
50,764 KB |
testcase_42 | AC | 199 ms
50,784 KB |
testcase_43 | AC | 124 ms
43,264 KB |
testcase_44 | AC | 55 ms
24,576 KB |
testcase_45 | AC | 201 ms
50,760 KB |
testcase_46 | AC | 98 ms
36,736 KB |
testcase_47 | AC | 200 ms
51,024 KB |
testcase_48 | AC | 155 ms
44,692 KB |
testcase_49 | AC | 200 ms
50,708 KB |
testcase_50 | AC | 29 ms
19,072 KB |
testcase_51 | AC | 118 ms
40,960 KB |
testcase_52 | AC | 182 ms
48,556 KB |
testcase_53 | AC | 134 ms
42,752 KB |
testcase_54 | AC | 201 ms
50,768 KB |
testcase_55 | AC | 172 ms
48,980 KB |
testcase_56 | AC | 172 ms
48,972 KB |
testcase_57 | AC | 151 ms
44,172 KB |
testcase_58 | AC | 64 ms
26,880 KB |
testcase_59 | AC | 29 ms
19,200 KB |
testcase_60 | AC | 146 ms
43,264 KB |
testcase_61 | AC | 28 ms
19,072 KB |
testcase_62 | AC | 98 ms
36,992 KB |
testcase_63 | AC | 200 ms
50,884 KB |
testcase_64 | AC | 170 ms
48,844 KB |
testcase_65 | AC | 35 ms
19,968 KB |
testcase_66 | AC | 81 ms
34,304 KB |
testcase_67 | AC | 92 ms
34,432 KB |
testcase_68 | AC | 88 ms
34,304 KB |
testcase_69 | AC | 30 ms
19,200 KB |
testcase_70 | AC | 99 ms
36,736 KB |
testcase_71 | AC | 200 ms
50,772 KB |
testcase_72 | AC | 198 ms
50,768 KB |
testcase_73 | AC | 203 ms
50,896 KB |
testcase_74 | AC | 200 ms
51,032 KB |
testcase_75 | AC | 201 ms
50,912 KB |
testcase_76 | AC | 201 ms
50,880 KB |
testcase_77 | AC | 202 ms
50,904 KB |
testcase_78 | AC | 27 ms
18,944 KB |
testcase_79 | AC | 28 ms
19,072 KB |
testcase_80 | AC | 202 ms
50,784 KB |
testcase_81 | AC | 200 ms
50,904 KB |
testcase_82 | AC | 203 ms
50,776 KB |
testcase_83 | AC | 172 ms
48,816 KB |
testcase_84 | AC | 116 ms
29,824 KB |
testcase_85 | AC | 242 ms
38,656 KB |
testcase_86 | AC | 166 ms
34,816 KB |
testcase_87 | AC | 150 ms
33,536 KB |
testcase_88 | AC | 44 ms
23,732 KB |
testcase_89 | AC | 42 ms
23,040 KB |
testcase_90 | AC | 300 ms
42,368 KB |
testcase_91 | AC | 64 ms
25,472 KB |
testcase_92 | AC | 51 ms
24,320 KB |
testcase_93 | AC | 240 ms
39,680 KB |
testcase_94 | AC | 155 ms
33,920 KB |
testcase_95 | AC | 122 ms
31,360 KB |
testcase_96 | AC | 103 ms
29,056 KB |
testcase_97 | AC | 48 ms
23,936 KB |
testcase_98 | AC | 286 ms
43,520 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); var yf = ToBoolN(y); for (int i = n - 1; i >= 0; i--) { var af = ToBool(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 (yf[f] == null) continue; if (af[f]) t[f] = yf[f]; else if (yf[f] == true) { 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 (yf[f] == null) continue; if (!af[f]) t[f] = yf[f]; else if (yf[f] == false) { ok = false; break; } } if (ok) { p.Push(2); yf = t; continue; } } return -1; } if (!Matches(xf, yf)) return -1; return string.Join(" ", p); } }