結果

問題 No.1623 三角形の制作
ユーザー 👑 KazunKazun
提出日時 2021-08-14 00:24:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 82,468 KB
実行使用メモリ 136,048 KB
最終ジャッジ日時 2024-04-14 21:45:13
合計ジャッジ時間 4,529 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,140 KB
testcase_01 AC 49 ms
61,540 KB
testcase_02 AC 140 ms
106,196 KB
testcase_03 AC 137 ms
105,860 KB
testcase_04 AC 139 ms
106,428 KB
testcase_05 AC 190 ms
136,048 KB
testcase_06 AC 93 ms
81,104 KB
testcase_07 AC 138 ms
106,004 KB
testcase_08 AC 96 ms
83,016 KB
testcase_09 AC 130 ms
103,356 KB
testcase_10 AC 167 ms
120,500 KB
testcase_11 AC 152 ms
107,648 KB
testcase_12 AC 85 ms
101,172 KB
testcase_13 AC 91 ms
102,312 KB
testcase_14 AC 90 ms
101,292 KB
testcase_15 AC 148 ms
134,612 KB
testcase_16 AC 148 ms
134,872 KB
testcase_17 AC 146 ms
134,348 KB
testcase_18 AC 155 ms
135,728 KB
testcase_19 AC 99 ms
109,316 KB
testcase_20 AC 36 ms
52,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#How many (r,g,b) st r>g+b ?

N=int(input())
inf=float("inf")
R=list(map(int,input().split()))
G=list(map(int,input().split()))
B=list(map(int,input().split()))

M=max(max(R),max(G),max(B))
X=[0]*(M+1); Y=[0]*(M+1); Z=[0]*(M+1)

for i in range(N):
    X[R[i]]+=1
    Y[G[i]]+=1
    Z[B[i]]+=1

Z_cum=[0]*(M+1)
for i in range(1,M+1):
    Z_cum[i]=Z_cum[i-1]+Z[i]

K=0
for a in range(1,M+1):
    for b in range(1,a+1):
        p=a-b
        K+=X[a]*Y[b]*(Z_cum[a]-Z_cum[p])

print(K)
0