結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,228 KB
testcase_01 AC 30 ms
10,228 KB
testcase_02 AC 29 ms
10,228 KB
testcase_03 AC 33 ms
10,228 KB
testcase_04 WA -
testcase_05 AC 31 ms
10,228 KB
testcase_06 AC 30 ms
10,228 KB
testcase_07 WA -
testcase_08 AC 32 ms
10,228 KB
testcase_09 AC 30 ms
10,228 KB
testcase_10 AC 29 ms
10,228 KB
testcase_11 AC 29 ms
10,228 KB
testcase_12 AC 32 ms
10,228 KB
testcase_13 WA -
testcase_14 AC 30 ms
10,228 KB
testcase_15 AC 30 ms
10,228 KB
testcase_16 WA -
testcase_17 AC 30 ms
10,228 KB
testcase_18 AC 30 ms
10,228 KB
testcase_19 AC 30 ms
10,228 KB
testcase_20 AC 29 ms
10,228 KB
testcase_21 AC 30 ms
10,228 KB
testcase_22 AC 30 ms
10,228 KB
testcase_23 AC 318 ms
33,296 KB
testcase_24 AC 304 ms
33,148 KB
testcase_25 AC 30 ms
10,228 KB
testcase_26 AC 29 ms
10,228 KB
testcase_27 AC 307 ms
33,296 KB
testcase_28 AC 312 ms
33,296 KB
testcase_29 AC 308 ms
33,296 KB
testcase_30 AC 295 ms
31,156 KB
testcase_31 AC 73 ms
13,424 KB
testcase_32 AC 166 ms
21,244 KB
testcase_33 AC 223 ms
26,156 KB
testcase_34 AC 124 ms
17,204 KB
testcase_35 AC 219 ms
24,928 KB
testcase_36 AC 103 ms
16,160 KB
testcase_37 AC 63 ms
12,632 KB
testcase_38 AC 179 ms
22,388 KB
testcase_39 AC 115 ms
16,936 KB
testcase_40 AC 287 ms
13,696 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