結果
| 問題 |
No.1623 三角形の制作
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2021-07-23 22:07:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 485 ms / 2,000 ms |
| コード長 | 809 bytes |
| コンパイル時間 | 253 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 135,360 KB |
| 最終ジャッジ日時 | 2024-07-18 17:51:11 |
| 合計ジャッジ時間 | 7,066 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
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+1, max(g, b))
y = min(N+1, g+b)
cnt = RC[y-1]-RC[x-1]
ans += max(0, cnt)*gc*bc
print(ans)
if __name__ == '__main__':
main()
brthyyjp