結果
| 問題 | No.2519 Coins in Array |
| コンテスト | |
| ユーザー |
MasKoaTS
|
| 提出日時 | 2023-08-29 19:59:01 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 379 bytes |
| 記録 | |
| コンパイル時間 | 243 ms |
| コンパイル使用メモリ | 82,484 KB |
| 実行使用メモリ | 103,828 KB |
| 最終ジャッジ日時 | 2024-06-23 12:22:34 |
| 合計ジャッジ時間 | 8,759 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 37 |
ソースコード
import sys
from math import gcd
from itertools import permutations
from functools import reduce
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
if(n >= 4):
exit(print(0))
def f(x, y):
if(gcd(x, y) == 1):
return (x - 1) * (y - 1)
return 0
ans = 10 ** 18
for p in permutations(a):
ans = min(ans, reduce(f, p))
print(ans)
MasKoaTS