結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー tamatotamato
提出日時 2021-10-29 21:52:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,021 ms / 3,000 ms
コード長 1,045 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 345,452 KB
最終ジャッジ日時 2024-04-16 14:43:05
合計ジャッジ時間 27,758 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,352 KB
testcase_01 AC 42 ms
52,352 KB
testcase_02 AC 40 ms
52,352 KB
testcase_03 AC 47 ms
58,496 KB
testcase_04 AC 55 ms
62,336 KB
testcase_05 AC 57 ms
62,976 KB
testcase_06 AC 50 ms
59,776 KB
testcase_07 AC 42 ms
52,736 KB
testcase_08 AC 49 ms
59,648 KB
testcase_09 AC 50 ms
60,160 KB
testcase_10 AC 54 ms
61,568 KB
testcase_11 AC 53 ms
61,568 KB
testcase_12 AC 61 ms
65,408 KB
testcase_13 AC 49 ms
59,264 KB
testcase_14 AC 225 ms
137,600 KB
testcase_15 AC 633 ms
237,792 KB
testcase_16 AC 836 ms
267,956 KB
testcase_17 AC 575 ms
237,692 KB
testcase_18 AC 454 ms
184,492 KB
testcase_19 AC 749 ms
268,556 KB
testcase_20 AC 258 ms
144,768 KB
testcase_21 AC 743 ms
265,636 KB
testcase_22 AC 369 ms
147,712 KB
testcase_23 AC 382 ms
154,220 KB
testcase_24 AC 2,021 ms
339,552 KB
testcase_25 AC 1,978 ms
345,452 KB
testcase_26 AC 1,993 ms
343,804 KB
testcase_27 AC 2,001 ms
342,764 KB
testcase_28 AC 1,975 ms
336,560 KB
testcase_29 AC 1,979 ms
334,064 KB
testcase_30 AC 1,996 ms
345,176 KB
testcase_31 AC 1,960 ms
339,556 KB
testcase_32 AC 2,021 ms
338,320 KB
testcase_33 AC 1,976 ms
337,556 KB
testcase_34 AC 49 ms
58,496 KB
testcase_35 AC 42 ms
51,968 KB
testcase_36 AC 43 ms
52,224 KB
testcase_37 AC 41 ms
52,608 KB
testcase_38 AC 157 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9
K = 10 ** 10


def main():
    import sys
    input = sys.stdin.readline

    def solve(AB, CD, P):
        N = len(AB)
        M = len(CD)
        S = {}
        for i in range(N):
            a, b = AB[i]
            p = P[i]
            for j in range(M):
                c, d = CD[j]
                hsh = (a - c) * K + (b - d)
                if hsh not in S:
                    S[hsh] = 0
                S[hsh] += p
        res = 0
        for s in S:
            res = max(res, S[s])
        return res

    N, M = map(int, input().split())
    P = list(map(int, input().split()))
    AB = []
    CD = []
    for _ in range(N):
        AB.append(tuple(map(int, input().split())))
    for _ in range(M):
        CD.append(tuple(map(int, input().split())))
    AB1 = [(-a, b) for a, b in AB]
    AB2 = [(a, -b) for a, b in AB]
    AB3 = [(-a, -b) for a, b in AB]

    ans = max(solve(AB, CD, P), solve(AB1, CD, P), solve(AB2, CD, P), solve(AB3, CD, P))
    print(ans)


if __name__ == '__main__':
    main()
0