結果

問題 No.1623 三角形の制作
ユーザー brthyyjpbrthyyjp
提出日時 2021-07-23 22:03:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 805 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 86,808 KB
実行使用メモリ 160,756 KB
最終ジャッジ日時 2023-09-25 22:06:43
合計ジャッジ時間 8,758 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
76,428 KB
testcase_01 AC 100 ms
76,412 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 138 ms
103,444 KB
testcase_13 AC 144 ms
111,948 KB
testcase_14 AC 143 ms
107,996 KB
testcase_15 AC 203 ms
157,728 KB
testcase_16 AC 203 ms
157,716 KB
testcase_17 AC 203 ms
157,900 KB
testcase_18 AC 203 ms
159,332 KB
testcase_19 AC 162 ms
130,544 KB
testcase_20 AC 99 ms
76,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

from collections import defaultdict
from itertools import accumulate

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

    GC = defaultdict(lambda: 0)
    BC = defaultdict(lambda: 0)
    N = 3*10**3
    RC = [0]*(N+1)
    for g in G:
        GC[g] += 1
    for b in B:
        BC[b] += 1
    for r in R:
        RC[r] += 1
    RC = list(accumulate(RC))
    ans = 0
    for g, gc in GC.items():
        for b, bc in BC.items():
            x = min(N, max(g, b))
            y = min(N, g+b)
            cnt = RC[y-1]-RC[x-1]
            ans += max(0, cnt)*gc*bc
    print(ans)

if __name__ == '__main__':
    main()
0