結果

問題 No.2965 Don't Stop the Game again
ユーザー Kude
提出日時 2024-11-16 16:43:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,024 ms
コード長 669 bytes
コンパイル時間 533 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 52,736 KB
最終ジャッジ日時 2024-11-16 16:43:25
合計ジャッジ時間 6,619 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

m = int(input())
q = list(map(int, input().split()))
asks = []
for j in range(1, 51):
    asks.append((1, j))

one = q.index(1)
for x in range(1, 41):
    ids = []
    for i in range(50):
        if i != one and q[i] == x:
            ids.append(i)
    if len(ids) >= 2:
        i1, i2 = ids[:2]
        for k in range(m.bit_length() - 1)[::-1]:
            asks.append((4, i1+1, i1+1, i1+1))
            if m >> k & 1:
                asks.append((4, i1+1, i2+1, i1+1))
        for i in range(50):
            if i != one and i != i1:
                asks.append((3, i1+1, i1+1, i+1))
        break
else:
    assert False

print(len(asks))
for x in asks:
    print(*x)
0