結果

問題 No.1596 Distance Sum in 2D Plane
ユーザー sasa8uyauyasasa8uyauya
提出日時 2023-10-12 19:34:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 935 ms / 2,000 ms
コード長 337 bytes
コンパイル時間 1,598 ms
コンパイル使用メモリ 86,484 KB
実行使用メモリ 105,428 KB
最終ジャッジ日時 2023-10-12 19:34:18
合計ジャッジ時間 15,053 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
104,888 KB
testcase_01 AC 99 ms
104,912 KB
testcase_02 AC 912 ms
105,156 KB
testcase_03 AC 929 ms
105,060 KB
testcase_04 AC 935 ms
105,276 KB
testcase_05 AC 914 ms
105,132 KB
testcase_06 AC 923 ms
105,080 KB
testcase_07 AC 916 ms
105,232 KB
testcase_08 AC 904 ms
105,272 KB
testcase_09 AC 923 ms
105,428 KB
testcase_10 AC 910 ms
105,144 KB
testcase_11 AC 837 ms
105,164 KB
testcase_12 AC 835 ms
104,912 KB
testcase_13 AC 859 ms
105,136 KB
testcase_14 AC 74 ms
71,328 KB
testcase_15 AC 71 ms
71,432 KB
testcase_16 AC 72 ms
71,120 KB
testcase_17 AC 70 ms
71,284 KB
testcase_18 AC 72 ms
71,260 KB
testcase_19 AC 72 ms
71,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0