結果
問題 | No.1373 Directed Operations |
ユーザー |
![]() |
提出日時 | 2021-02-05 21:49:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 477 ms / 2,000 ms |
コード長 | 865 bytes |
コンパイル時間 | 190 ms |
コンパイル使用メモリ | 81,880 KB |
実行使用メモリ | 100,992 KB |
最終ジャッジ日時 | 2024-07-02 12:21:48 |
合計ジャッジ時間 | 6,012 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
import sys import math import collections import bisect # sys.setrecursionlimit(10000001) INF = 10 ** 20 MOD = 10 ** 9 + 7 # MOD = 998244353 def ni(): return int(sys.stdin.buffer.readline()) def ns(): return map(int, sys.stdin.buffer.readline().split()) def na(): return list(map(int, sys.stdin.buffer.readline().split())) def na1(): return list(map(lambda x: int(x)-1, sys.stdin.buffer.readline().split())) # ===CODE=== def main(): n = ni() a = na() a = [[ai, i, -1] for i, ai in enumerate(a)] a.sort() flg = True for i in range(2, n+1): if a[i-2][0] > i-1: flg = False break a[i-2][2] = i-a[i-2][0] if flg: print("YES") a.sort(key=lambda x: x[1]) for ai, idx,res in a: print(res) else: print("NO") if __name__ == '__main__': main()