結果

問題 No.2519 Coins in Array
ユーザー ニックネームニックネーム
提出日時 2023-10-27 23:25:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 11,848 KB
実行使用メモリ 33,344 KB
最終ジャッジ日時 2023-10-27 23:25:45
合計ジャッジ時間 7,024 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
10,276 KB
testcase_01 AC 25 ms
10,276 KB
testcase_02 AC 24 ms
10,276 KB
testcase_03 AC 23 ms
10,276 KB
testcase_04 WA -
testcase_05 AC 25 ms
10,276 KB
testcase_06 AC 24 ms
10,276 KB
testcase_07 AC 24 ms
10,276 KB
testcase_08 AC 23 ms
10,276 KB
testcase_09 AC 24 ms
10,276 KB
testcase_10 AC 24 ms
10,276 KB
testcase_11 AC 24 ms
10,276 KB
testcase_12 AC 23 ms
10,276 KB
testcase_13 AC 24 ms
10,276 KB
testcase_14 AC 23 ms
10,276 KB
testcase_15 AC 24 ms
10,276 KB
testcase_16 AC 24 ms
10,276 KB
testcase_17 AC 24 ms
10,276 KB
testcase_18 AC 23 ms
10,276 KB
testcase_19 AC 24 ms
10,276 KB
testcase_20 AC 24 ms
10,276 KB
testcase_21 AC 24 ms
10,276 KB
testcase_22 AC 24 ms
10,276 KB
testcase_23 AC 286 ms
33,344 KB
testcase_24 AC 267 ms
33,196 KB
testcase_25 AC 24 ms
10,276 KB
testcase_26 AC 23 ms
10,276 KB
testcase_27 AC 265 ms
33,344 KB
testcase_28 AC 288 ms
33,344 KB
testcase_29 AC 267 ms
33,344 KB
testcase_30 AC 240 ms
31,204 KB
testcase_31 AC 61 ms
13,472 KB
testcase_32 AC 140 ms
21,292 KB
testcase_33 AC 191 ms
26,204 KB
testcase_34 AC 102 ms
17,252 KB
testcase_35 AC 175 ms
24,976 KB
testcase_36 AC 87 ms
16,208 KB
testcase_37 AC 53 ms
12,680 KB
testcase_38 AC 175 ms
22,436 KB
testcase_39 AC 96 ms
16,984 KB
testcase_40 AC 238 ms
13,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
n = int(input())
a = list(map(int,input().split()))
def f(x,y): return 0 if gcd(x,y)>1 else 1 if x==y==1 else (x-1)*(y-1)
if n==2: print(f(a[0],a[1])); print(1,2)
elif n==3:
    p,q,r = f(f(a[0],a[1]),a[2]),f(f(a[1],a[2]),a[0]),f(f(a[2],a[0]),a[1])
    if q>=p<=r: print(p); print(1,2); print(1,2)
    elif q<=r: print(q); print(2,3); print(1,2)
    else: print(r); print(3,1); print(1,2)
else:
    print(0); print(1,2); print(1,2); print(n-3,n-2)
    for i in range(n-3,1,-1): print(1,i)
0