結果
問題 |
No.2500 Products in a Range
|
ユーザー |
|
提出日時 | 2023-10-13 22:33:57 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 646 bytes |
コンパイル時間 | 296 ms |
コンパイル使用メモリ | 81,692 KB |
実行使用メモリ | 489,788 KB |
最終ジャッジ日時 | 2024-09-15 18:19:01 |
合計ジャッジ時間 | 4,940 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 TLE * 1 -- * 52 |
ソースコード
import heapq import sys input = sys.stdin.readline N, L, R = map(int, input().split()) A = list(map(int, input().split())) Z = [[0, i, set()] for i in range(N)] for i in range(N): for j in range(N): if i==j or L<=A[i]*A[j]<=R: pass else: Z[i][0]-=1 Z[i][2].add(j) heapq.heapify(Z) ng = 0 while Z[0][0]<0: #print(R) D = dict() for i in range(len(Z)): D[Z[i][1]] = i #print(D) c, r, COL = Z[0] for col in COL: idx = D[col] Z[idx][0]+=1 Z[idx][2].discard(r) heapq.heappop(Z) #print(R) ng += 1 heapq.heapify(Z) print(N-ng)