結果

問題 No.3184 Make Same
コンテスト
ユーザー flippergo
提出日時 2025-06-24 10:15:04
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 192 ms / 2,000 ms
+ 91µs
コード長 464 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 234 ms
コンパイル使用メモリ 96,364 KB
実行使用メモリ 185,472 KB
最終ジャッジ日時 2026-07-12 19:11:51
合計ジャッジ時間 11,404 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
A = list(map(int,input().split()))
ans = []
amax = A[-1]
while A[0]<amax:
    dmax = A[1]
    v = amax-A[0]
    ind = 0
    for i in range(1,N):
        if A[i]==amax:break
        d = amax-A[i]
        l = min(A[0]+d,A[i+1])
        if l>dmax:
            dmax = l
            ind = i
    ans.append((1,ind+1,amax-A[ind]))
    for i in range(ind+1):
        A[i] += amax-A[ind]
    A = sorted(A)
print(len(ans))
for l,r,v in ans:
    print(l,r,v)
0