結果
| 問題 | No.1373 Directed Operations |
| コンテスト | |
| ユーザー |
qwewe
|
| 提出日時 | 2025-04-24 12:21:25 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 895 bytes |
| 記録 | |
| コンパイル時間 | 260 ms |
| コンパイル使用メモリ | 96,104 KB |
| 実行使用メモリ | 103,680 KB |
| 最終ジャッジ日時 | 2026-07-10 04:50:52 |
| 合計ジャッジ時間 | 4,629 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 1 TLE * 1 -- * 17 |
ソースコード
N = int(input())
a = list(map(int, input().split()))
connected = [False] * (N + 2) # 1-based indexing
connected[1] = True
smallest_unconnected = 2
x_list = []
possible = True
for ai in a:
k = smallest_unconnected
found = False
while k <= N:
if not connected[k]:
x = k - ai
if x >= 1 and connected[x]:
connected[k] = True
x_list.append(x)
# Update smallest_unconnected
while smallest_unconnected <= N and connected[smallest_unconnected]:
smallest_unconnected += 1
found = True
break
else:
k += 1
else:
k += 1
if not found:
possible = False
break
if possible and smallest_unconnected > N:
print("YES")
for x in x_list:
print(x)
else:
print("NO")
qwewe