結果

問題 No.775 tatyamと素数大富豪(hard)
ユーザー kamomekamome
提出日時 2019-07-03 23:53:10
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 929 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 11,012 KB
実行使用メモリ 9,972 KB
最終ジャッジ日時 2023-08-04 04:39:53
合計ジャッジ時間 7,385 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,244 KB
testcase_01 AC 16 ms
8,308 KB
testcase_02 AC 16 ms
8,148 KB
testcase_03 AC 16 ms
8,276 KB
testcase_04 AC 16 ms
8,368 KB
testcase_05 AC 17 ms
8,176 KB
testcase_06 AC 82 ms
8,264 KB
testcase_07 AC 801 ms
8,688 KB
testcase_08 AC 1,555 ms
8,872 KB
testcase_09 WA -
testcase_10 TLE -
testcase_11 AC 16 ms
8,180 KB
testcase_12 AC 16 ms
8,288 KB
testcase_13 AC 361 ms
8,616 KB
testcase_14 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python3
import itertools
N,K=map(int,input().split())
l=input().split()
mx=max(list(map(lambda x:int(x[0]),l)))
def sort_weight(_n):
    if len(_n)==2:
        return float(_n)
    if len(_n)==1:
        return float(_n)*10+mx+0.5
def sort_weight_rev(_n):
    if len(_n)==2:
        return float(_n)
    if len(_n)==1:
        return float(_n)*10+mx-0.5

l2=sorted(l, key=sort_weight,reverse=True)
l3=sorted(l, key=sort_weight_rev,reverse=True)

count=0
kouho=[]
for i in itertools.permutations(l2):
    appendkouho=int("".join(i))
    if not appendkouho in kouho:
        kouho.append(appendkouho)
    count=count+1
    if count>=10*K:
        break
count=0
for i in itertools.permutations(l3):
    appendkouho=int("".join(i))
    if not appendkouho in kouho:
        kouho.append(appendkouho)
    count=count+1
    if count>=10*K:
        break
kouho=sorted(kouho,reverse=True)
for i in range(K):
    print(kouho[i])
0