Submission #1209937


Source Code Expand

Copy
n, m = map(int, input().split())
mod = 10**9 + 7
X = [int(i) for i in input().split()]
Y = [int(i) for i in input().split()]
ans = 0
for i in range(n-1):
	for j in range(m-1):
		ans += abs(X[i+1] - X[i])%mod * abs(Y[j+1] - Y[j])%mod * ((i+1)%mod) * ((n-i-1)%mod) * ((j+1)%mod) * ((m-j-1)%mod)
		ans %= mod
print(ans)

Submission Info

Submission Time
Task D - 井井井 / ###
User TAB
Language Python3 (3.4.3)
Score 0
Code Size 325 Byte
Status

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt
All 0 / 500 0_000.txt, 0_001.txt, max.txt, min.txt, mod.txt, n2.txt, rndA.txt, rndB.txt, rndC.txt, rndD.txt, rndE.txt, rndF.txt, rndG.txt, rndH.txt, rndI.txt, rndJ.txt, var.txt
Case Name Status Exec Time Memory
0_000.txt 17 ms 3064 KB
0_001.txt 17 ms 3064 KB
max.txt
min.txt 17 ms 3064 KB
mod.txt 311 ms 14468 KB
n2.txt 192 ms 14464 KB
rndA.txt
rndB.txt
rndC.txt
rndD.txt
rndE.txt
rndF.txt
rndG.txt
rndH.txt
rndI.txt
rndJ.txt
var.txt