結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,224 KB
testcase_01 AC 30 ms
10,224 KB
testcase_02 AC 29 ms
10,224 KB
testcase_03 AC 30 ms
10,224 KB
testcase_04 WA -
testcase_05 AC 30 ms
10,224 KB
testcase_06 AC 30 ms
10,224 KB
testcase_07 WA -
testcase_08 AC 30 ms
10,224 KB
testcase_09 AC 30 ms
10,224 KB
testcase_10 AC 30 ms
10,224 KB
testcase_11 AC 30 ms
10,224 KB
testcase_12 AC 32 ms
10,224 KB
testcase_13 WA -
testcase_14 AC 29 ms
10,224 KB
testcase_15 AC 30 ms
10,224 KB
testcase_16 WA -
testcase_17 AC 29 ms
10,224 KB
testcase_18 AC 29 ms
10,224 KB
testcase_19 AC 29 ms
10,224 KB
testcase_20 AC 29 ms
10,224 KB
testcase_21 AC 31 ms
10,224 KB
testcase_22 AC 29 ms
10,224 KB
testcase_23 AC 335 ms
33,292 KB
testcase_24 WA -
testcase_25 AC 29 ms
10,224 KB
testcase_26 AC 29 ms
10,224 KB
testcase_27 AC 340 ms
33,292 KB
testcase_28 AC 337 ms
33,292 KB
testcase_29 AC 345 ms
33,292 KB
testcase_30 AC 337 ms
31,156 KB
testcase_31 AC 77 ms
13,424 KB
testcase_32 AC 180 ms
21,240 KB
testcase_33 AC 255 ms
25,312 KB
testcase_34 AC 132 ms
17,200 KB
testcase_35 AC 228 ms
24,924 KB
testcase_36 AC 111 ms
16,156 KB
testcase_37 AC 66 ms
12,896 KB
testcase_38 AC 214 ms
22,384 KB
testcase_39 AC 122 ms
16,932 KB
testcase_40 AC 326 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*y-x-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:
    j = -1; print(0)
    for i,v in enumerate(a):
        if v%3==0: j = i
    if j==-1: print(1,2); print(1,2)
    else: print(j+1,(j+1)%n+1); print(1,n-1)
    for i in range(n-2,1,-1): print(1,i)
0