結果

問題 No.1623 三角形の制作
ユーザー ntudantuda
提出日時 2021-08-20 23:32:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 210 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 472 ms
コンパイル使用メモリ 82,032 KB
実行使用メモリ 139,112 KB
最終ジャッジ日時 2024-04-22 08:12:29
合計ジャッジ時間 4,292 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,272 KB
testcase_01 AC 52 ms
62,384 KB
testcase_02 AC 148 ms
106,532 KB
testcase_03 AC 146 ms
105,736 KB
testcase_04 AC 144 ms
105,952 KB
testcase_05 AC 210 ms
139,112 KB
testcase_06 AC 93 ms
82,956 KB
testcase_07 AC 143 ms
106,084 KB
testcase_08 AC 92 ms
84,072 KB
testcase_09 AC 138 ms
103,356 KB
testcase_10 AC 184 ms
123,416 KB
testcase_11 AC 162 ms
110,212 KB
testcase_12 AC 88 ms
101,152 KB
testcase_13 AC 94 ms
102,760 KB
testcase_14 AC 92 ms
100,840 KB
testcase_15 AC 153 ms
136,376 KB
testcase_16 AC 151 ms
136,276 KB
testcase_17 AC 149 ms
136,140 KB
testcase_18 AC 157 ms
137,396 KB
testcase_19 AC 100 ms
109,212 KB
testcase_20 AC 38 ms
53,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = sorted(list(map(int,input().split())))

Amax = max(A)
AL = [0] * (Amax + 1)
BL = [0] * (Amax + 1)

for a in A:
    AL[a] += 1

for b in B:
    if b <= Amax:
        BL[b] += 1

CC = [0] * (Amax+1)
j = 0
temp = 0
for c in C:
    if c > Amax:
        break
    while j < c:
        j += 1
        CC[j] = CC[j-1]
    temp += 1
    CC[j] = temp
while j < Amax:
    j += 1
    CC[j] = CC[j-1]

ans = 0
for i in range(Amax + 1):
    for j in range(i + 1):
        ans += (CC[i] - CC[i - j]) * AL[i] * BL[j]
print(ans)
0