結果

問題 No.2261 Coffee
ユーザー 👑 KazunKazun
提出日時 2023-04-07 21:38:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 711 ms / 2,000 ms
コード長 791 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 82,608 KB
実行使用メモリ 91,824 KB
最終ジャッジ日時 2024-04-10 16:46:18
合計ジャッジ時間 20,209 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,328 KB
testcase_01 AC 36 ms
53,728 KB
testcase_02 AC 37 ms
52,272 KB
testcase_03 AC 36 ms
53,288 KB
testcase_04 AC 37 ms
52,836 KB
testcase_05 AC 40 ms
58,836 KB
testcase_06 AC 40 ms
58,400 KB
testcase_07 AC 36 ms
53,120 KB
testcase_08 AC 39 ms
58,760 KB
testcase_09 AC 41 ms
58,644 KB
testcase_10 AC 93 ms
76,704 KB
testcase_11 AC 101 ms
76,820 KB
testcase_12 AC 78 ms
76,060 KB
testcase_13 AC 73 ms
75,876 KB
testcase_14 AC 92 ms
76,268 KB
testcase_15 AC 65 ms
75,484 KB
testcase_16 AC 74 ms
75,832 KB
testcase_17 AC 308 ms
80,816 KB
testcase_18 AC 310 ms
80,932 KB
testcase_19 AC 305 ms
80,532 KB
testcase_20 AC 298 ms
80,260 KB
testcase_21 AC 313 ms
80,396 KB
testcase_22 AC 301 ms
79,752 KB
testcase_23 AC 316 ms
80,744 KB
testcase_24 AC 651 ms
90,216 KB
testcase_25 AC 612 ms
88,980 KB
testcase_26 AC 668 ms
91,380 KB
testcase_27 AC 657 ms
91,004 KB
testcase_28 AC 574 ms
85,316 KB
testcase_29 AC 571 ms
84,580 KB
testcase_30 AC 521 ms
83,904 KB
testcase_31 AC 665 ms
86,564 KB
testcase_32 AC 647 ms
86,532 KB
testcase_33 AC 641 ms
86,152 KB
testcase_34 AC 649 ms
86,488 KB
testcase_35 AC 651 ms
87,332 KB
testcase_36 AC 650 ms
86,948 KB
testcase_37 AC 642 ms
86,028 KB
testcase_38 AC 681 ms
91,420 KB
testcase_39 AC 711 ms
90,644 KB
testcase_40 AC 706 ms
91,288 KB
testcase_41 AC 699 ms
91,044 KB
testcase_42 AC 699 ms
90,960 KB
testcase_43 AC 703 ms
90,700 KB
testcase_44 AC 696 ms
91,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def sgn(s,k):
    return 1 if (s>>k)&1 else -1

def solve():
    N=int(input())
    A=[0]*N; B=[0]*N; C=[0]*N; D=[0]*N; E=[0]*N
    for i in range(N):
        A[i],B[i],C[i],D[i],E[i]=map(int,input().split())

    K=5

    inf=float("inf")
    T=[inf]*(1<<K)
    for s in range(1<<K):
        for i in range(N):
            T[s]=min(T[s],
                    sgn(s,0)*A[i]+sgn(s,1)*B[i]+sgn(s,2)*C[i]+sgn(s,3)*D[i]+sgn(s,4)*E[i])

    Ans=[-inf]*N
    for i in range(N):
        for s in range(1<<K):
            Ans[i]=max(Ans[i],
                    sgn(s,0)*A[i]+sgn(s,1)*B[i]+sgn(s,2)*C[i]+sgn(s,3)*D[i]+sgn(s,4)*E[i]-T[s])
    return Ans

#==================================================
import sys
input=sys.stdin.readline
write=sys.stdout.write

write("\n".join(map(str,solve())))
0