結果

問題 No.1623 三角形の制作
ユーザー moshi777moshi777
提出日時 2021-07-23 23:14:19
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 765 bytes
コンパイル時間 888 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 135,040 KB
最終ジャッジ日時 2023-09-26 01:38:18
合計ジャッジ時間 29,162 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,532 KB
testcase_01 AC 233 ms
77,920 KB
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 AC 180 ms
103,096 KB
testcase_13 AC 231 ms
111,584 KB
testcase_14 AC 221 ms
107,328 KB
testcase_15 AC 259 ms
132,500 KB
testcase_16 AC 262 ms
132,320 KB
testcase_17 AC 207 ms
132,276 KB
testcase_18 AC 316 ms
135,040 KB
testcase_19 AC 148 ms
127,044 KB
testcase_20 AC 92 ms
71,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
from bisect import bisect_right, bisect_left
N = int(input())

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

B.sort()

#rdd = defaultdict(int)
#gdd = defaultdict(int)

rnum = [0]*(3*10**3+1)
gnum = [0]*(3*10**3+1)

for i in range(N):
    # rdd[R[i]] += 1
    # gdd[G[i]] += 1
    rnum[R[i]] += 1
    gnum[G[i]] += 1

# print(rdd, gdd)
ans = 0
maxR = max(R)
for i in range(1, maxR+1):
    for j in range(1, i+1):
        add = rnum[i]*gnum[j]*(bisect_right(B, i) - bisect_right(B, i-j))
        ans += add
        """
        if r < g:
            continue
        add = rv*gv*(bisect_right(B, r) - bisect_right(B, r-g))
        # print(add)

        """

print(ans)
0