結果

問題 No.3527 Minimum Abs Sum
コンテスト
ユーザー titia
提出日時 2026-05-06 06:11:45
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 479 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 803 ms
コンパイル使用メモリ 20,696 KB
実行使用メモリ 67,416 KB
最終ジャッジ日時 2026-05-06 06:12:02
合計ジャッジ時間 10,830 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline

from collections import Counter

mod=10**9+7

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

C=Counter()

for i in range(N):
    a,b=A[i],B[i]

    if a==0:
        continue
    if a<0:
        a=-a
        b=-b

    C[a,b]+=a

MAX=max(C.values())

LIST=[]
for c in C:
    if C[c]==MAX:
        LIST.append(c)

ANS=min(LIST,key=lambda x:x[1]/x[0])

LANS=ANS[1]*pow(ANS[0],mod-2,mod)%mod

print(LANS)
    
0