結果

問題 No.3324 ハイライト動画
コンテスト
ユーザー cologne
提出日時 2025-11-14 14:46:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 185 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 116,832 KB
最終ジャッジ日時 2025-11-14 14:46:23
合計ジャッジ時間 5,846 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def input(): return sys.stdin.readline().rstrip('\n')


def main():
    n, m = map(int, input().split())
    *a, = map(int, input().split())

    ans = []
    arr = []
    for i in a:
        if not arr or arr[-1] + 1 == i:
            arr.append(i)
        else:
            ans.append((arr[0], len(arr)))
            arr = [i]

    ans.append((arr[0], len(arr)))

    print(len(ans))
    for k, v in ans:
        print(k, v)


if __name__ == '__main__':
    main()
0