結果
問題 |
No.1017 Reiwa Sequence
|
ユーザー |
![]() |
提出日時 | 2023-07-15 06:38:19 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 569 bytes |
コンパイル時間 | 117 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 123,168 KB |
最終ジャッジ日時 | 2024-09-16 15:03:55 |
合計ジャッジ時間 | 55,392 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 TLE * 9 -- * 13 |
ソースコード
import sys readline=sys.stdin.readline from collections import defaultdict N=int(readline()) A=list(map(int,readline().split())) dct=defaultdict(list) bit=1 while bit<1<<len(A): S=sum(A[i] for i in range(min(30,len(A))) if bit&1<<i) dct[S].append(bit) if len(dct[S])>=2: break bit+=1 else: print("No") exit() bit0,bit1=dct[S][0],dct[S][1] for i in range(len(A)): if i<30 and bit0&1<<i and not bit1&1<<i: A[i]*=-1 elif i<30 and not bit0&1<<i and bit1&1<<i: A[i]*=1 else: A[i]*=0 print("Yes") print(*A)