結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,272 KB
testcase_01 AC 26 ms
10,272 KB
testcase_02 AC 24 ms
10,272 KB
testcase_03 AC 28 ms
10,272 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 25 ms
10,272 KB
testcase_07 AC 24 ms
10,272 KB
testcase_08 AC 24 ms
10,272 KB
testcase_09 AC 26 ms
10,272 KB
testcase_10 AC 26 ms
10,272 KB
testcase_11 AC 25 ms
10,272 KB
testcase_12 AC 23 ms
10,272 KB
testcase_13 AC 25 ms
10,272 KB
testcase_14 AC 25 ms
10,272 KB
testcase_15 AC 24 ms
10,272 KB
testcase_16 AC 24 ms
10,272 KB
testcase_17 AC 24 ms
10,272 KB
testcase_18 AC 24 ms
10,272 KB
testcase_19 AC 24 ms
10,272 KB
testcase_20 AC 24 ms
10,272 KB
testcase_21 AC 26 ms
10,272 KB
testcase_22 AC 24 ms
10,272 KB
testcase_23 AC 269 ms
33,340 KB
testcase_24 AC 264 ms
33,192 KB
testcase_25 AC 25 ms
10,272 KB
testcase_26 AC 25 ms
10,272 KB
testcase_27 AC 262 ms
33,340 KB
testcase_28 AC 285 ms
33,340 KB
testcase_29 AC 265 ms
33,340 KB
testcase_30 AC 241 ms
31,200 KB
testcase_31 AC 61 ms
13,468 KB
testcase_32 AC 139 ms
21,288 KB
testcase_33 AC 232 ms
26,200 KB
testcase_34 AC 147 ms
17,248 KB
testcase_35 AC 212 ms
24,972 KB
testcase_36 AC 103 ms
16,204 KB
testcase_37 AC 61 ms
12,676 KB
testcase_38 AC 175 ms
22,432 KB
testcase_39 AC 112 ms
16,980 KB
testcase_40 AC 313 ms
13,740 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 x+y>1 else 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