编译器是在歧视python么

import heapq
if name == '__main__':
x = []
cost = 0
temp1 = []
n = int(input())
str_in = input().split()
for i in str_in:
x.append(int(i))
heapq.heapify(x)
for i in range(1, n):
temp1 = heapq.nsmallest(2, x)
temp = sum(temp1)
heapq.heappop(x)
heapq.heappush(x, temp)
heapq.heappop(x)
cost += temp
print(cost)

5 条评论

  • @ 2019-11-09 16:11:13

    我是用numpy.argmin(a)和a.remove()写的,代码很简单,也是过不了而且事WrongAnswer,好奇怪!感觉没什么错误

  • @ 2018-07-20 16:07:48

    怎么可能

  • @ 2018-07-20 16:07:33

    不啊

  • @ 2018-07-18 11:37:27

    歧视是什么鬼……Python本来就比C++慢很多啊

  • @ 2018-07-17 16:28:49

    同样用了堆, c++能过 python过不了

  • 1

信息

ID
1097
难度
6
分类
贪心 点击显示
标签
递交数
23854
已通过
6310
通过率
26%
被复制
41
上传者