結果
| 問題 | 
                            No.2519 Coins in Array
                             | 
                    
| コンテスト | |
| ユーザー | 
                             MasKoaTS
                         | 
                    
| 提出日時 | 2023-03-12 17:02:42 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 409 bytes | 
| コンパイル時間 | 536 ms | 
| コンパイル使用メモリ | 82,536 KB | 
| 実行使用メモリ | 102,624 KB | 
| 最終ジャッジ日時 | 2024-06-23 12:22:04 | 
| 合計ジャッジ時間 | 8,931 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 4 | 
| other | WA * 37 | 
ソースコード
import sys from math import gcd from itertools import permutations input = sys.stdin.readline n = int(input()) a = list(map(int, input().split())) if(n >= 4): print(0) exit(0) def f(x, y): if(0 in (x, y) or gcd(x, y) >= 2): return 0 return (x - 1) * (y - 1) ans = 10 ** 18 + 1 for p in permutations(a): t = f(p[0], p[1]) if(n == 3): t = f(t, p[2]) if(ans <= t): continue ans = t print(ans)
            
MasKoaTS