結果

問題 No.1623 三角形の制作
ユーザー lloyzlloyz
提出日時 2021-12-08 22:02:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 811 bytes
コンパイル時間 1,849 ms
コンパイル使用メモリ 86,508 KB
実行使用メモリ 134,880 KB
最終ジャッジ日時 2023-09-23 10:24:01
合計ジャッジ時間 8,016 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
76,736 KB
testcase_01 AC 109 ms
76,836 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 144 ms
102,700 KB
testcase_13 AC 155 ms
111,340 KB
testcase_14 AC 150 ms
107,108 KB
testcase_15 AC 211 ms
134,816 KB
testcase_16 AC 209 ms
134,752 KB
testcase_17 AC 212 ms
134,880 KB
testcase_18 AC 221 ms
133,556 KB
testcase_19 AC 177 ms
130,172 KB
testcase_20 AC 111 ms
76,948 KB
権限があれば一括ダウンロードができます

ソースコード

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 - i):
        if B_len_cnt[j] == 0:
            continue
        ans += G_len_cnt[i] * B_len_cnt[j] * (accumR_len_cnt[i + j - 1] - accumR_len_cnt[max(i, j) - 1])
print(ans)

0