結果

問題 No.1623 三角形の制作
ユーザー lloyzlloyz
提出日時 2021-12-08 22:09:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 846 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 34,392 KB
最終ジャッジ日時 2023-09-23 10:28:21
合計ジャッジ時間 4,072 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
13,132 KB
testcase_01 AC 22 ms
8,720 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush
from collections import defaultdict

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

R_len_cnt = [0 for _ in range(3001)]
G_len_cnt = [0 for _ in range(3001)]
B_len_cnt = [0 for _ in range(3001)]
for i in range(n):
    R_len_cnt[R[i]] += 1
    G_len_cnt[G[i]] += 1
    B_len_cnt[B[i]] += 1
accumR_len_cnt = [0 for _ in range(3001)]
for i in range(3000):
    accumR_len_cnt[i + 1] += accumR_len_cnt[i] + R_len_cnt[i + 1]
ans = 0
for i in range(1, 3001):
    if G_len_cnt[i] == 0:
        continue
    for j in range(1, 3001):
        if B_len_cnt[j] == 0:
            continue
        ans += G_len_cnt[i] * B_len_cnt[j] * (accumR_len_cnt[min(i + j, 3001) - 1] - accumR_len_cnt[max(i, j) - 1])
print(ans)

0