結果
問題 |
No.1001 注文の多い順列
|
ユーザー |
![]() |
提出日時 | 2020-03-03 15:16:43 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 292 bytes |
コンパイル時間 | 286 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 11,520 KB |
最終ジャッジ日時 | 2024-10-13 22:36:23 |
合計ジャッジ時間 | 17,423 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 TLE * 1 |
ソースコード
import sys m = 10**9+7 n = int(input()) l = [list(map(int, s.split())) for s in sys.stdin] l = sorted((x-t, t) for t, x in l) c = [1]+[0]*n d = 1 for i, (x, t) in enumerate(l): d += t for j in range(d-1, -1, -1): c[j] = (c[j-1]*j - c[j]*(x-i+j) if t else c[j]*(x-i+j)) % m print(sum(c)%m)