結果

問題 No.1632 Sorting Integers (GCD of M)
ユーザー rin204
提出日時 2021-07-30 20:59:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 81,880 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2024-09-15 22:48:45
合計ジャッジ時間 4,744 ms
ジャッジサーバーID
(参考情報)
judge6 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 27 WA * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
cnt = [0] + list(map(int, input().split()))
if n == 1:
    for i, c in enumerate(cnt):
        if c == 1:
            print(i)
            exit()
            
tot = 0
two = 8
five = 5
seven = 7
for i, c in enumerate(cnt):
    tot += i * c
    if c > 0:
        if i == 8:
            pass
        elif i == 4:
            two = max(two, 4)
        elif i == 2:
            two = max(two, 2)
        else:
            two = 1
        if i != 5:
            five = 1
        if i != 7:
            seven = 1
        
ans = two * five * seven
if tot % 9 == 0:
    ans *= 9
elif tot % 3 == 0:
    ans *= 3
print(ans)
0