[過去ログ]
Qiita 6 - キータぞ、来たぞ、キータだぞー (1002レス)
Qiita 6 - キータぞ、来たぞ、キータだぞー http://mevius.5ch.net/test/read.cgi/tech/1739527246/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
このスレッドは過去ログ倉庫に格納されています。
次スレ検索
歴削→次スレ
栞削→次スレ
過去ログメニュー
520: デフォルトの名無しさん [sage] 2025/07/07(月) 12:41:17.70 ID:f/uaRi3/ メンテとか完全性考えると普通にこんくらいでよくない? 時間・資源の関係上ユースケース的にXOR使うんだったらそれはそれで別の観点ありそう。 import numpy as np import time N = 10_000_000 arr = np.random.permutation(N) + 1 # 1〜N の順列(重複なし) arr[123] = arr[456] # 重複を入れる arr = np.delete(arr, 789) # 欠損を入れる start = time.perf_counter() # 重複チェック・欠損チェックの両方に対応 counts = np.bincount(arr, minlength=N+1)[1:] # arrが1-basedなのでスライス[1:] duplicates = np.where(counts > 1)[0] + 1 missing = np.where(counts == 0)[0] + 1 end = time.perf_counter() print(f"重複: {duplicates[:10]}") print(f"欠損: {missing[:10]}") print(f"処理時間: {end - start:.3f} 秒") http://mevius.5ch.net/test/read.cgi/tech/1739527246/520
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 482 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.011s