結果

問題 No.1623 三角形の制作
ユーザー noriocnorioc
提出日時 2022-05-18 20:05:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 284 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 3,445 ms
コンパイル使用メモリ 81,632 KB
実行使用メモリ 141,040 KB
最終ジャッジ日時 2023-10-16 23:37:45
合計ジャッジ時間 5,636 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
59,260 KB
testcase_01 AC 42 ms
62,120 KB
testcase_02 AC 237 ms
104,396 KB
testcase_03 AC 236 ms
104,084 KB
testcase_04 AC 231 ms
104,164 KB
testcase_05 AC 284 ms
137,268 KB
testcase_06 AC 189 ms
83,032 KB
testcase_07 AC 241 ms
104,116 KB
testcase_08 AC 194 ms
85,624 KB
testcase_09 AC 227 ms
101,836 KB
testcase_10 AC 268 ms
126,988 KB
testcase_11 AC 246 ms
109,460 KB
testcase_12 AC 81 ms
97,220 KB
testcase_13 AC 87 ms
98,760 KB
testcase_14 AC 83 ms
95,888 KB
testcase_15 AC 154 ms
141,040 KB
testcase_16 AC 154 ms
141,040 KB
testcase_17 AC 154 ms
141,040 KB
testcase_18 AC 150 ms
138,072 KB
testcase_19 AC 100 ms
108,360 KB
testcase_20 AC 40 ms
59,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
from itertools import accumulate

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

size = 3010
bs = [0] * size
for b in B:
    bs[b] += 1
cum = list(accumulate(bs))

rs = Counter(R)
gs = Counter(G)
ans = 0
for r in rs:
    for g in range(1, r+1):
        if gs[g] == 0: continue
        ans += (cum[r] - cum[r-g]) * rs[r] * gs[g]

print(ans)
0