結果
| 問題 | No.482 あなたの名は |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-25 09:59:43 |
| 言語 | Python3 (3.14.3 + numpy 2.4.2 + scipy 1.17.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 420 bytes |
| 記録 | |
| コンパイル時間 | 638 ms |
| コンパイル使用メモリ | 20,704 KB |
| 実行使用メモリ | 67,988 KB |
| 最終ジャッジ日時 | 2026-01-13 12:26:41 |
| 合計ジャッジ時間 | 8,074 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 3 |
| other | TLE * 28 |
ソースコード
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
int1 = lambda x: int(x) - 1
N, K = map(int, input().split())
D = tuple(map(int1, input().split()))
matr = csr_matrix(([1] * N, (D, range(N))), shape=(N, N))
p = connected_components(matr, connection='strong', return_labels=False)
surplus_swap = K - (N - p)
print('YES' if surplus_swap >= 0 and surplus_swap % 2 == 0 else 'NO')