結果
問題 | No.1017 Reiwa Sequence |
ユーザー | ygd. |
提出日時 | 2021-05-18 15:00:35 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,016 bytes |
コンパイル時間 | 175 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 306,720 KB |
最終ジャッジ日時 | 2024-04-17 04:26:35 |
合計ジャッジ時間 | 15,111 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 40 ms
53,888 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | AC | 49 ms
65,380 KB |
testcase_15 | AC | 51 ms
64,824 KB |
testcase_16 | AC | 51 ms
65,216 KB |
testcase_17 | AC | 54 ms
68,044 KB |
testcase_18 | AC | 51 ms
64,164 KB |
testcase_19 | AC | 330 ms
151,872 KB |
testcase_20 | AC | 335 ms
151,800 KB |
testcase_21 | AC | 321 ms
151,596 KB |
testcase_22 | AC | 330 ms
151,640 KB |
testcase_23 | AC | 323 ms
151,800 KB |
testcase_24 | AC | 327 ms
151,624 KB |
testcase_25 | AC | 320 ms
151,844 KB |
testcase_26 | AC | 305 ms
151,580 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | TLE | - |
testcase_41 | TLE | - |
testcase_42 | TLE | - |
testcase_43 | TLE | - |
testcase_44 | WA | - |
testcase_45 | TLE | - |
testcase_46 | TLE | - |
testcase_47 | WA | - |
testcase_48 | TLE | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | AC | 40 ms
55,056 KB |
testcase_52 | WA | - |
testcase_53 | WA | - |
ソースコード
N = int(input()) A = list(map(int,input().split())) num = min(N, 22) from collections import defaultdict dic = defaultdict(list) for i in range(1,1<<num): temp = 0 for j in range(num): if (i>>j)&1 == 1: temp += A[j] dic[temp].append(i) #print(dic) def overlap(p,q): for i in range(30): if (p>>i)&1 == 1 and (q>>i)&1 == 1: return False return True ret = [0]*N for x in dic.keys(): if len(dic[x]) <= 1: continue n = len(dic[x]) for i in range(n): a = dic[x][i] for j in range(i+1,n): b = dic[x][j] if not overlap(a,b): continue for s in range(30): if (a>>s)&1 == 1: ret[s] = 1 if (b>>s)&1 == 1: ret[s] = -1 Flag = 0 if (a>>s)&1 == 1 and (b>>s)&1 == 1: Flag = 1 assert Flag == 0 print("Yes") print(*ret); exit() print("No")