結果
| 問題 |
No.2261 Coffee
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-07 21:55:41 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 692 ms / 2,000 ms |
| コード長 | 742 bytes |
| コンパイル時間 | 374 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 118,400 KB |
| 最終ジャッジ日時 | 2024-10-02 19:28:07 |
| 合計ジャッジ時間 | 17,716 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 42 |
ソースコード
import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd
n = int(input())
par = []
d = defaultdict(lambda: -float("inf"))
for i in range(n):
a = list(map(int,input().split()))
l = []
for bit in range(32):
tmp = 0
for j in range(5):
if (bit >> j) & 1:
tmp += a[j]
else:
tmp -= a[j]
l.append(tmp)
d[bit] = max(d[bit], tmp)
par.append(l)
for i in range(n):
ans = -float("inf")
for j in range(32):
ans = max(ans, d[31-j] + par[i][j])
print(ans)