結果
問題 | No.1373 Directed Operations |
ユーザー | NatsubiSogan |
提出日時 | 2021-02-05 22:05:33 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 511 bytes |
コンパイル時間 | 1,233 ms |
コンパイル使用メモリ | 87,148 KB |
実行使用メモリ | 94,020 KB |
最終ジャッジ日時 | 2023-09-15 08:14:05 |
合計ジャッジ時間 | 7,013 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 73 ms
71,576 KB |
testcase_02 | WA | - |
testcase_03 | AC | 113 ms
92,808 KB |
testcase_04 | AC | 110 ms
93,396 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 304 ms
93,760 KB |
testcase_10 | AC | 269 ms
91,552 KB |
testcase_11 | AC | 120 ms
78,424 KB |
testcase_12 | AC | 259 ms
90,788 KB |
testcase_13 | AC | 95 ms
76,956 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
ソースコード
import sys sys.setrecursionlimit(10 ** 6) n = int(input()) a = list(map(int, input().split())) a2 = [(a[i], i) for i in range(n - 1)] a2.sort(reverse=True) v = [0] * n v[0] = 1 ans = [0] * (n - 1) G = [[] for i in range(n)] for i in range(n - 1): if a[a2[i][1]] + i < n: ans[a2[i][1]] = i + 1 G[i].append(i + a2[i][0]) else: exit(print("NO")) def dfs(now): v[now] = 1 for nex in G[now]: dfs(nex) if all(v for i in range(n)): print("YES") else: print("NO")