結果

問題 No.1623 三角形の制作
ユーザー playerplayer
提出日時 2023-12-20 02:18:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 554 ms / 2,000 ms
コード長 704 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 141,232 KB
最終ジャッジ日時 2023-12-20 02:18:36
合計ジャッジ時間 14,299 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 401 ms
70,684 KB
testcase_01 AC 405 ms
70,684 KB
testcase_02 AC 485 ms
104,904 KB
testcase_03 AC 468 ms
104,476 KB
testcase_04 AC 471 ms
104,728 KB
testcase_05 AC 552 ms
137,208 KB
testcase_06 AC 423 ms
82,844 KB
testcase_07 AC 478 ms
104,604 KB
testcase_08 AC 426 ms
85,600 KB
testcase_09 AC 460 ms
102,088 KB
testcase_10 AC 511 ms
127,580 KB
testcase_11 AC 479 ms
111,652 KB
testcase_12 AC 446 ms
97,280 KB
testcase_13 AC 477 ms
98,760 KB
testcase_14 AC 449 ms
96,228 KB
testcase_15 AC 537 ms
141,232 KB
testcase_16 AC 533 ms
141,232 KB
testcase_17 AC 528 ms
141,228 KB
testcase_18 AC 554 ms
138,272 KB
testcase_19 AC 470 ms
108,324 KB
testcase_20 AC 411 ms
70,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

def main():
    n = int(input())
    r = list(map(int,input().split()))
    g = list(map(int,input().split()))
    b = list(map(int,input().split()))
    dg,db,dr = defaultdict(int),defaultdict(int),defaultdict(int)
    for i in range(n):
        dg[g[i]] += 1
        db[b[i]] += 1
        dr[r[i]] += 1
    acc = [0]*(3001)
    for i in range(1,3001):
        if i not in dr:
            acc[i] += acc[i-1]
        else:
            acc[i] += acc[i-1]+dr[i]
    ans = 0
    for i in range(1,3001):
        for j in range(1,3001):
            ans += dg[i]*db[j]*(acc[min(i+j-1,3000)]-acc[max(i,j)-1])
            
    
    print(ans)
    
if __name__ == '__main__':
    main()
0