結果
問題 | No.703 ゴミ拾い Easy |
ユーザー | tjake |
提出日時 | 2018-06-15 23:50:01 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,158 bytes |
コンパイル時間 | 441 ms |
コンパイル使用メモリ | 87,228 KB |
実行使用メモリ | 196,584 KB |
最終ジャッジ日時 | 2023-09-13 05:28:08 |
合計ジャッジ時間 | 17,173 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
71,352 KB |
testcase_01 | AC | 70 ms
71,264 KB |
testcase_02 | AC | 71 ms
71,316 KB |
testcase_03 | AC | 71 ms
71,404 KB |
testcase_04 | WA | - |
testcase_05 | AC | 75 ms
71,432 KB |
testcase_06 | AC | 69 ms
71,412 KB |
testcase_07 | AC | 72 ms
71,304 KB |
testcase_08 | WA | - |
testcase_09 | AC | 71 ms
71,316 KB |
testcase_10 | WA | - |
testcase_11 | AC | 71 ms
71,260 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 93 ms
76,736 KB |
testcase_15 | AC | 93 ms
76,600 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 92 ms
76,616 KB |
testcase_20 | AC | 93 ms
76,668 KB |
testcase_21 | WA | - |
testcase_22 | AC | 95 ms
77,344 KB |
testcase_23 | AC | 97 ms
77,124 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 438 ms
196,228 KB |
testcase_35 | AC | 416 ms
195,564 KB |
testcase_36 | AC | 414 ms
195,384 KB |
testcase_37 | AC | 425 ms
195,400 KB |
testcase_38 | AC | 413 ms
196,584 KB |
testcase_39 | AC | 417 ms
195,520 KB |
testcase_40 | AC | 437 ms
196,036 KB |
testcase_41 | AC | 441 ms
195,384 KB |
testcase_42 | AC | 420 ms
195,880 KB |
testcase_43 | AC | 436 ms
195,452 KB |
testcase_44 | AC | 72 ms
71,268 KB |
testcase_45 | AC | 72 ms
71,444 KB |
testcase_46 | AC | 380 ms
179,736 KB |
testcase_47 | AC | 399 ms
177,544 KB |
testcase_48 | WA | - |
testcase_49 | WA | - |
ソースコード
N = int(input()) *A, = map(int, input().split()) *X, = map(int, input().split()) *Y, = map(int, input().split()) N0 = 2**(N-1).bit_length() data = [None]*(2*N0+1) # Li Chao Tree def f(line, x): p, q = line return p*x + q def _add_line(line, k, l, r): m = (l + r) // 2 if data[k] is None: data[k] = line return lx = A[l] mx = A[m] rx = A[r-1] left = (f(line, lx) < f(data[k], lx)) mid = (f(line, mx) < f(data[k], mx)) right = (f(line, rx) < f(data[k], rx)) if left and right: data[k] = line return if not left and not right: return if mid: data[k], line = line, data[k] if left != mid: _add_line(line, 2*k+1, l, m) else: _add_line(line, 2*k+2, m, r) def add_line(line): return _add_line(line, 0, 0, N) def query(k, x): def gen(k, x): k += N0-1 while k >= 0: if data[k]: yield f(data[k], x) k = (k - 1) // 2 return min(gen(k, x)) v = 0 for i in range(N): x = X[i]; a = A[i]; y = Y[i] add_line((-2*x, x**2 + y**2 + v)) v = query(i, a) + a**2 print(v)