結果
| 問題 | No.1623 三角形の制作 |
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2021-07-23 22:03:27 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 805 bytes |
| 記録 | |
| コンパイル時間 | 491 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 135,484 KB |
| 最終ジャッジ日時 | 2024-07-18 17:47:48 |
| 合計ジャッジ時間 | 7,120 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 WA * 10 |
ソースコード
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()
brthyyjp