結果

問題 No.3184 Make Same
ユーザー zozu
提出日時 2025-07-01 02:01:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 549 ms / 2,000 ms
コード長 1,182 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 82,768 KB
実行使用メモリ 264,692 KB
最終ジャッジ日時 2025-07-01 02:01:58
合計ジャッジ時間 18,729 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
from collections import deque
from collections import Counter
from collections import defaultdict
import bisect
from functools import reduce
from functools import lru_cache
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD99 = 998244353

def main():
    N = I()
    A = LI()
    def check(A):
        if len(set(A)) == 1:
            return True
        else:
            return False
    ans = 0
    anss = []
    while not check(A):
        am = A[-1]
        now = 2 ** (len(bin(am)) - 3)
        r = bisect.bisect_left(A, now)
        if r != 0:
            ans += 1
            anss.append((1, r, now))
        for i in range(N):
            if A[i] >= now:
                A[i] -= now
        A.sort()
    print(ans)
    for l, r, v in anss:
        print(l, r, v)
if __name__ == "__main__":
    main()
0