結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー LyricalMaestroLyricalMaestro
提出日時 2024-01-23 02:09:14
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,281 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 119,244 KB
最終ジャッジ日時 2024-01-23 02:09:21
合計ジャッジ時間 6,374 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 39 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 49 ms
61,980 KB
testcase_04 AC 69 ms
72,384 KB
testcase_05 AC 69 ms
72,256 KB
testcase_06 AC 67 ms
66,108 KB
testcase_07 AC 53 ms
61,988 KB
testcase_08 AC 50 ms
64,060 KB
testcase_09 AC 55 ms
66,108 KB
testcase_10 AC 63 ms
72,920 KB
testcase_11 AC 103 ms
75,324 KB
testcase_12 AC 142 ms
75,708 KB
testcase_13 AC 48 ms
61,980 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

## https://yukicoder.me/problems/no/1726


def main():
    N, M = map(int, input().split())
    P = list(map(int, input().split()))
    grasses = {}
    for i in  range(N):
        a, b = map(int, input().split())
        grasses[(a, b)] = P[i]

    balls = []
    for _ in range(M):
        c, d = map(int, input().split())
        balls.append((c, d))
    
    def calc(balls, grasses, keys):
        answer = 0
        vectors = set()
        for base_ball in balls:

            for gx, gy in keys:
                vx = gx - base_ball[0]
                vy = gy - base_ball[1]
                vectors.add((vx, vy))
        
        for vx, vy in vectors:
            ans = 0
            for x, y in balls:
                if (x + vx, y + vy) in grasses:
                    ans += grasses[(x + vx, y + vy)]
            answer = max(answer, ans)
        return answer
    
    keys = list(grasses.keys())
    answer1 = calc(balls, grasses, keys)
    answer2 = calc([(x, -y) for x, y in balls], grasses, keys)
    answer3 = calc([(-x, y) for x, y in balls], grasses, keys)
    answer4 = calc([(-x, -y) for x, y in balls], grasses, keys)
    answer = max(answer1, answer2, answer3, answer4)
    print(answer)

            




    











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