結果
問題 | No.1919 Many Monster Battles |
ユーザー | とりゐ |
提出日時 | 2022-04-04 00:01:28 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 565 bytes |
コンパイル時間 | 297 ms |
コンパイル使用メモリ | 86,852 KB |
実行使用メモリ | 181,644 KB |
最終ジャッジ日時 | 2023-09-02 13:45:38 |
合計ジャッジ時間 | 17,148 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 72 ms
71,248 KB |
testcase_01 | AC | 71 ms
71,592 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 87 ms
76,600 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 635 ms
161,320 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 569 ms
178,412 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 568 ms
158,244 KB |
testcase_30 | AC | 571 ms
168,472 KB |
testcase_31 | WA | - |
testcase_32 | AC | 667 ms
171,208 KB |
testcase_33 | WA | - |
testcase_34 | WA | - |
ソースコード
mod=10**9+7 n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) def f(x): y=sorted(x) res=0 sm=0 for i in range(n): res+=i*y[i]-sm res%=mod sm+=y[i] sm%=mod return res def g(x,y): u,v=[],[] for i in range(n): u.append(x[i]-y[i]) v.append(x[i]+y[i]) return (f(u)+f(v))//2 m=2*10**9 a1=[(m+1)*i for i in a] a2=[m*i for i in a] b1=[(m+1)*i for i in b] b2=[m*i for i in b] num1=g(a,b) num2=g(a2,b1) num3=g(a1,b2) num4=g(a2,b2) ans1=num1-num2+num4 ans2=num1-num3+num4 print(2*ans1%mod,2*ans2%mod)