結果
問題 | No.1623 三角形の制作 |
ユーザー | U S |
提出日時 | 2021-07-23 22:40:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,204 ms / 2,000 ms |
コード長 | 1,280 bytes |
コンパイル時間 | 431 ms |
コンパイル使用メモリ | 87,084 KB |
実行使用メモリ | 117,736 KB |
最終ジャッジ日時 | 2023-09-25 23:02:34 |
合計ジャッジ時間 | 15,375 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 111 ms
73,072 KB |
testcase_01 | AC | 110 ms
73,276 KB |
testcase_02 | AC | 1,152 ms
104,240 KB |
testcase_03 | AC | 1,146 ms
105,088 KB |
testcase_04 | AC | 1,158 ms
105,436 KB |
testcase_05 | AC | 1,204 ms
111,920 KB |
testcase_06 | AC | 1,109 ms
84,220 KB |
testcase_07 | AC | 1,163 ms
105,236 KB |
testcase_08 | AC | 1,116 ms
85,524 KB |
testcase_09 | AC | 1,150 ms
102,552 KB |
testcase_10 | AC | 1,163 ms
104,100 KB |
testcase_11 | AC | 1,155 ms
100,024 KB |
testcase_12 | AC | 147 ms
93,504 KB |
testcase_13 | AC | 160 ms
99,308 KB |
testcase_14 | AC | 157 ms
96,228 KB |
testcase_15 | AC | 210 ms
117,464 KB |
testcase_16 | AC | 212 ms
117,736 KB |
testcase_17 | AC | 209 ms
117,680 KB |
testcase_18 | AC | 210 ms
111,776 KB |
testcase_19 | AC | 173 ms
110,988 KB |
testcase_20 | AC | 112 ms
73,044 KB |
ソースコード
import sys #sys.setrecursionlimit(1000000) input = sys.stdin.readline def mp():return map(int,input().split()) def lmp():return list(map(int,input().split())) import math import bisect from copy import deepcopy as dc from itertools import accumulate from collections import Counter, defaultdict, deque import itertools def ceil(U,V):return (U+V-1)//V def modf1(N,MOD):return (N-1)%MOD+1 inf = int(1e10) mod = int(1e9+7) n = int(input()) r = sorted(list(Counter(lmp()).items())) g = sorted(list(Counter(lmp()).items())) b = [(-inf,0)]+sorted(list(Counter(lmp()).items()))+[(inf, 0)] bc = [0] for i in range(1,len(b)): bc.append(bc[-1]+b[i][1]) ans = 0 #print(bc) for i,u in r: for j,v in g: if i < j:break L,R = 0,len(b)-1 while (R-L) != 1: m = (R+L)//2 if b[m][0] <= i-j: L = m else: R = m #print(L,R) LL,RR = 0,len(b)-1 while (RR-LL) != 1: #print(LL,RR) m = (RR+LL)//2 if b[m][0] <= i: LL = m else: RR = m #print(i,j,bc[L],bc[RR]) # L = bisect.bisect_right(b,i-j) # R = bisect.bisect_right(b,i) ans += max(0,(bc[LL]-bc[L]))*u*v print(ans)