結果
| 問題 |
No.1017 Reiwa Sequence
|
| ユーザー |
|
| 提出日時 | 2024-10-08 23:04:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,161 bytes |
| コンパイル時間 | 333 ms |
| コンパイル使用メモリ | 82,308 KB |
| 実行使用メモリ | 114,684 KB |
| 最終ジャッジ日時 | 2024-10-08 23:04:55 |
| 合計ジャッジ時間 | 38,956 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 45 WA * 5 |
ソースコード
N = int(input())
A = list(map(int, input().split()))
M = 150001
exist = [-1] * M
for i, ai in enumerate(A):
if exist[ai] != -1:
ans = [0] * N
ans[i] = -ai
ans[exist[ai]] = ai
print('Yes')
print(*ans)
quit()
exist[ai] = i
order = sorted(range(N), key=lambda i:A[i])
dp = [[0]*2*M]
dp[0][0] = 1
for pos, i in enumerate(order):
ai = A[i]
if dp[-1][ai]:
print('Yes')
ans = [0] * N
ans[i] = -ai
now = ai
for ii in order[:pos][::-1]:
dp.pop()
aii = A[ii]
if dp[-1][now]:
continue
if -M+1 <= now - aii and dp[-1][now-aii]:
now -= aii
ans[ii] = aii
continue
if now + aii < M and dp[-1][now+aii]:
now += aii
ans[ii] = -aii
print(*ans)
quit()
nex = [0] * 2*M
for j in range(-M+1, M):
nex[j] |= dp[-1][j]
if dp[-1][j]:
if -M+1 <= j-ai:
nex[j-ai] = 1
if j+ai < M:
nex[j+ai] = 1
dp.append(nex)
print('No')