結果

問題 No.927 Second Permutation
ユーザー liny_tail
提出日時 2023-01-03 17:44:46
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 342 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 26,680 KB
最終ジャッジ日時 2024-11-27 02:18:51
合計ジャッジ時間 67,911 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 TLE * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

def calc(lst):
  M = ''
  for i in itertools.permutations(lst, r = len(lst)):
    if M == '':
      M = ''.join(i)
    else:
      tmp = ''.join(i)
      if M != tmp:
        return tmp
  else:
    return '0'

X = input().strip()

X = sorted(list(X), reverse=True)

ans = calc(X)

if ans[0] == '0':
  ans = '-1'

print(ans)
0