結果
問題 | No.198 キャンディー・ボックス2 |
ユーザー |
![]() |
提出日時 | 2022-06-24 03:49:18 |
言語 | Python3 (3.10.1 + numpy 1.22.3 + scipy 1.8.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 808 Byte |
コンパイル時間 | 316 ms |
使用メモリ | 9,800 KB |
最終ジャッジ日時 | 2022-06-24 03:49:24 |
合計ジャッジ時間 | 2,471 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
9,500 KB |
testcase_01 | AC | 31 ms
9,656 KB |
testcase_02 | AC | 30 ms
9,720 KB |
testcase_03 | AC | 30 ms
9,656 KB |
testcase_04 | AC | 30 ms
9,648 KB |
testcase_05 | AC | 30 ms
9,716 KB |
testcase_06 | AC | 31 ms
9,644 KB |
testcase_07 | AC | 30 ms
9,776 KB |
testcase_08 | AC | 30 ms
9,604 KB |
testcase_09 | AC | 30 ms
9,484 KB |
testcase_10 | AC | 30 ms
9,736 KB |
testcase_11 | AC | 30 ms
9,660 KB |
testcase_12 | AC | 30 ms
9,720 KB |
testcase_13 | AC | 31 ms
9,728 KB |
testcase_14 | AC | 31 ms
9,476 KB |
testcase_15 | AC | 32 ms
9,492 KB |
testcase_16 | AC | 31 ms
9,600 KB |
testcase_17 | AC | 31 ms
9,600 KB |
testcase_18 | AC | 32 ms
9,616 KB |
testcase_19 | WA | - |
testcase_20 | AC | 32 ms
9,568 KB |
testcase_21 | WA | - |
testcase_22 | AC | 31 ms
9,476 KB |
testcase_23 | WA | - |
testcase_24 | AC | 33 ms
9,568 KB |
testcase_25 | WA | - |
testcase_26 | AC | 31 ms
9,496 KB |
testcase_27 | AC | 30 ms
9,596 KB |
testcase_28 | WA | - |
testcase_29 | AC | 30 ms
9,504 KB |
ソースコード
import bisect import copy import decimal import fractions import heapq import itertools import math import random import sys import time from collections import Counter,deque,defaultdict from functools import lru_cache,reduce from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max def _heappush_max(heap,item): heap.append(item) heapq._siftdown_max(heap, 0, len(heap)-1) def _heappushpop_max(heap, item): if heap and item < heap[0]: item, heap[0] = heap[0], item heapq._siftup_max(heap, 0) return item from math import gcd as GCD read=sys.stdin.read readline=sys.stdin.readline readlines=sys.stdin.readlines B=int(readline()) N=int(readline()) C=[int(readline()) for i in range(N)] median=sorted(C)[N//2] ans=sum(abs(c-median) for c in C) print(ans)