結果
| 問題 | No.443 GCD of Permutation | 
| コンテスト | |
| ユーザー | 👑  SPD_9X2 | 
| 提出日時 | 2025-07-28 04:06:53 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 820 bytes | 
| コンパイル時間 | 337 ms | 
| コンパイル使用メモリ | 82,228 KB | 
| 実行使用メモリ | 78,396 KB | 
| 最終ジャッジ日時 | 2025-07-28 04:07:23 | 
| 合計ジャッジ時間 | 29,598 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 26 WA * 2 | 
ソースコード
"""
https://yukicoder.me/problems/no/443
桁が多い場合はほとんど1になりそうなんだよな
小さい場合は無作為shuffleでも効きそう
2222122
みたいなのに弱いか?
偶数対策だけしておくべきか
"""
import math
import random
import sys
from collections import defaultdict
# 制限を解除(無制限にしたい場合は0を指定)
sys.set_int_max_str_digits(0)
N = list(input())
dic = defaultdict(int)
for c in N:
    dic[int(c)] += 1
import time
start = time.time()
ans = 0
while True:
    random.shuffle(N)
    X = int("".join(N))
    ans = math.gcd(X,ans)
    
    # 0.8秒経ったらループを抜ける
    if time.time() - start > 0.8:
        break
if dic[1]+dic[3]+dic[5]+dic[7]+dic[9] > 0:
    while ans % 2 == 0:
        ans //= 2
print (ans)
            
            
            
        