結果
問題 |
No.1596 Distance Sum in 2D Plane
|
ユーザー |
![]() |
提出日時 | 2023-10-12 19:34:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 922 ms / 2,000 ms |
コード長 | 337 bytes |
コンパイル時間 | 437 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 104,576 KB |
最終ジャッジ日時 | 2024-09-14 17:57:09 |
合計ジャッジ時間 | 14,354 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
n,m=map(int,input().split()) M=1000000007 fa=[1] for i in range(1,n+n+1): fa+=[fa[-1]*i%M] a=fa[n+n]*pow(fa[n],M-2,M)*pow(fa[n],M-2,M)*(n+n)%M for i in range(m): t,x,y=map(int,input().split()) a-=fa[x+y]*pow(fa[x],M-2,M)*pow(fa[y],M-2,M)*fa[n-x-(t==1)+n-y-(t==2)]*pow(fa[n-x-(t==1)],M-2,M)*pow(fa[n-y-(t==2)],M-2,M) a%=M print(a)