結果

問題 No.443 GCD of Permutation
ユーザー minamiminami
提出日時 2019-03-27 05:17:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 358 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-04-19 09:11:22
合計ジャッジ時間 24,985 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 RE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 RE -
testcase_19 TLE -
testcase_20 RE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import random
import time
start = time.time()
S = input()


def gcd(x, y):
    while(y):
        t = x
        x = y
        y = t % y
    return x


T = 0.98
g = int(S)
l = list(S)
s = int("".join(sorted(l)))
r = int("".join(reversed(l)))
g = gcd(g, gcd(s, r))

while time.time() < start + T:
    random.shuffle(l)
    g = gcd(g, int("".join(l)))

print(g)
0