結果

問題 No.1373 Directed Operations
ユーザー yakeshibayakeshiba
提出日時 2021-06-07 23:56:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 221 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 101,364 KB
最終ジャッジ日時 2023-08-16 16:40:11
合計ジャッジ時間 6,490 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
72,556 KB
testcase_01 AC 105 ms
72,668 KB
testcase_02 AC 162 ms
92,268 KB
testcase_03 AC 136 ms
90,936 KB
testcase_04 AC 139 ms
91,448 KB
testcase_05 AC 106 ms
72,648 KB
testcase_06 AC 217 ms
101,364 KB
testcase_07 AC 124 ms
78,224 KB
testcase_08 AC 133 ms
80,704 KB
testcase_09 AC 177 ms
101,336 KB
testcase_10 AC 154 ms
89,944 KB
testcase_11 AC 126 ms
80,436 KB
testcase_12 AC 149 ms
89,628 KB
testcase_13 AC 115 ms
77,772 KB
testcase_14 AC 220 ms
99,244 KB
testcase_15 AC 202 ms
95,984 KB
testcase_16 AC 221 ms
98,920 KB
testcase_17 AC 164 ms
88,636 KB
testcase_18 AC 143 ms
84,888 KB
testcase_19 AC 153 ms
85,332 KB
testcase_20 AC 179 ms
95,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import copy

n = int(input())
Ao = list(map(int,input().split()))
A = copy.deepcopy(Ao)
A.sort()

visited = [0]*n
ans = defaultdict(list)

visited[0] = 1
ind = 1
for a in A:
    try:
        if visited[ind-a]:
            visited[ind] = 1
            ind += 1
            ans[a].append(ind-a)
        else:
            print("NO")
            exit()
    except IndexError:
        print("NO")
        exit()

print("YES")
for a in Ao:
    print(ans[a].pop())
0