結果

問題 No.1623 三角形の制作
ユーザー 👑 tamatotamato
提出日時 2021-07-23 21:30:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 319 ms / 2,000 ms
コード長 771 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,660 KB
実行使用メモリ 141,896 KB
最終ジャッジ日時 2023-09-25 21:18:47
合計ジャッジ時間 7,398 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 205 ms
76,124 KB
testcase_01 AC 201 ms
76,204 KB
testcase_02 AC 272 ms
104,948 KB
testcase_03 AC 267 ms
104,528 KB
testcase_04 AC 275 ms
104,524 KB
testcase_05 AC 318 ms
136,400 KB
testcase_06 AC 229 ms
83,924 KB
testcase_07 AC 272 ms
104,380 KB
testcase_08 AC 227 ms
85,764 KB
testcase_09 AC 257 ms
102,148 KB
testcase_10 AC 296 ms
127,304 KB
testcase_11 AC 280 ms
109,980 KB
testcase_12 AC 245 ms
97,228 KB
testcase_13 AC 249 ms
98,924 KB
testcase_14 AC 248 ms
96,440 KB
testcase_15 AC 315 ms
141,468 KB
testcase_16 AC 314 ms
141,896 KB
testcase_17 AC 319 ms
141,476 KB
testcase_18 AC 311 ms
136,928 KB
testcase_19 AC 260 ms
108,892 KB
testcase_20 AC 200 ms
76,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9
M = 3*10**3


def main():
    import sys
    input = sys.stdin.readline

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

    RR = [0] * (M+1)
    GG = [0] * (M+1)
    BB = [0] * (M+1)
    for i in range(N):
        RR[R[i]] += 1
        GG[G[i]] += 1
        BB[B[i]] += 1

    ans = 0
    cs_RR = [0] * (M+2)
    for i in range(M+1):
        cs_RR[i+1] = cs_RR[i] + RR[i]
    for i in range(M+1):
        for j in range(M+1):
            gb = GG[i] * BB[j]
            ans += gb * (cs_RR[min(M, i+j-1) + 1] - cs_RR[max(i, j)])

    print(ans)
    #print(RR)
    #print(GG)
    #print(BB)
    #print(cs_RR)


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