結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,288 KB
testcase_01 AC 24 ms
10,288 KB
testcase_02 AC 23 ms
10,288 KB
testcase_03 AC 24 ms
10,288 KB
testcase_04 WA -
testcase_05 AC 25 ms
10,288 KB
testcase_06 AC 24 ms
10,288 KB
testcase_07 WA -
testcase_08 AC 25 ms
10,288 KB
testcase_09 AC 31 ms
10,288 KB
testcase_10 AC 25 ms
10,288 KB
testcase_11 AC 25 ms
10,288 KB
testcase_12 AC 24 ms
10,288 KB
testcase_13 WA -
testcase_14 AC 24 ms
10,288 KB
testcase_15 AC 24 ms
10,288 KB
testcase_16 WA -
testcase_17 AC 25 ms
10,288 KB
testcase_18 AC 25 ms
10,288 KB
testcase_19 AC 24 ms
10,288 KB
testcase_20 AC 24 ms
10,288 KB
testcase_21 AC 23 ms
10,288 KB
testcase_22 AC 25 ms
10,288 KB
testcase_23 AC 260 ms
33,356 KB
testcase_24 WA -
testcase_25 AC 25 ms
10,288 KB
testcase_26 AC 25 ms
10,288 KB
testcase_27 AC 265 ms
33,356 KB
testcase_28 AC 261 ms
33,356 KB
testcase_29 WA -
testcase_30 AC 240 ms
31,224 KB
testcase_31 AC 64 ms
13,484 KB
testcase_32 AC 140 ms
21,304 KB
testcase_33 AC 213 ms
26,220 KB
testcase_34 AC 104 ms
17,744 KB
testcase_35 WA -
testcase_36 AC 88 ms
16,220 KB
testcase_37 WA -
testcase_38 AC 154 ms
22,448 KB
testcase_39 AC 99 ms
16,996 KB
testcase_40 AC 240 ms
13,760 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)
    for i in range(n-2,1,-1): print(1,i)
0