結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,192 KB
testcase_01 AC 30 ms
10,192 KB
testcase_02 AC 31 ms
10,192 KB
testcase_03 AC 30 ms
10,192 KB
testcase_04 WA -
testcase_05 AC 30 ms
10,192 KB
testcase_06 AC 30 ms
10,192 KB
testcase_07 AC 29 ms
10,192 KB
testcase_08 AC 29 ms
10,192 KB
testcase_09 AC 29 ms
10,192 KB
testcase_10 AC 31 ms
10,192 KB
testcase_11 AC 29 ms
10,192 KB
testcase_12 AC 29 ms
10,192 KB
testcase_13 AC 29 ms
10,192 KB
testcase_14 AC 29 ms
10,192 KB
testcase_15 AC 29 ms
10,192 KB
testcase_16 AC 29 ms
10,192 KB
testcase_17 AC 28 ms
10,192 KB
testcase_18 AC 29 ms
10,192 KB
testcase_19 AC 30 ms
10,192 KB
testcase_20 AC 30 ms
10,192 KB
testcase_21 AC 30 ms
10,192 KB
testcase_22 AC 29 ms
10,192 KB
testcase_23 AC 308 ms
33,260 KB
testcase_24 AC 309 ms
33,112 KB
testcase_25 AC 29 ms
10,192 KB
testcase_26 AC 29 ms
10,192 KB
testcase_27 AC 305 ms
33,260 KB
testcase_28 AC 305 ms
33,260 KB
testcase_29 AC 303 ms
33,260 KB
testcase_30 AC 287 ms
31,120 KB
testcase_31 AC 73 ms
13,388 KB
testcase_32 AC 165 ms
21,208 KB
testcase_33 AC 222 ms
26,120 KB
testcase_34 AC 126 ms
17,168 KB
testcase_35 AC 212 ms
24,892 KB
testcase_36 AC 103 ms
16,124 KB
testcase_37 AC 62 ms
12,596 KB
testcase_38 AC 176 ms
22,352 KB
testcase_39 AC 113 ms
16,900 KB
testcase_40 AC 287 ms
13,660 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 (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