結果

問題 No.1623 三角形の制作
ユーザー ayaoniayaoni
提出日時 2021-07-23 21:59:50
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 209 ms / 2,000 ms
コード長 976 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 139,104 KB
最終ジャッジ日時 2023-09-25 22:00:48
合計ジャッジ時間 5,065 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
76,024 KB
testcase_01 AC 79 ms
76,436 KB
testcase_02 AC 166 ms
105,740 KB
testcase_03 AC 163 ms
104,996 KB
testcase_04 AC 163 ms
105,132 KB
testcase_05 AC 209 ms
138,448 KB
testcase_06 AC 125 ms
83,956 KB
testcase_07 AC 163 ms
105,280 KB
testcase_08 AC 130 ms
86,524 KB
testcase_09 AC 162 ms
104,176 KB
testcase_10 AC 190 ms
124,300 KB
testcase_11 AC 170 ms
110,844 KB
testcase_12 AC 113 ms
98,568 KB
testcase_13 AC 120 ms
100,980 KB
testcase_14 AC 115 ms
98,260 KB
testcase_15 AC 171 ms
136,256 KB
testcase_16 AC 172 ms
136,260 KB
testcase_17 AC 173 ms
136,340 KB
testcase_18 AC 178 ms
139,104 KB
testcase_19 AC 131 ms
110,332 KB
testcase_20 AC 80 ms
75,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import accumulate
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


n = I()
R = LI()
G = LI()
B = LI()

count_R = [0]*(3*10**3+1)
count_G = [0]*(3*10**3+1)
count_B = [0]*(3*10**3+1)
for r in R:
    count_R[r] += 1
for g in G:
    count_G[g] += 1
for b in B:
    count_B[b] += 1
S_count_B = list(accumulate(count_B))

ans = 0
for i in range(1,3*10**3+1):
    cr = count_R[i]
    if not cr:
        continue
    for j in range(1,i+1):
        cg = count_G[j]
        if not cg:
            continue
        ans += cr*cg*(S_count_B[i]-S_count_B[i-j])

print(ans)
0