結果

問題 No.3324 ハイライト動画
コンテスト
ユーザー Prala
提出日時 2025-11-01 15:10:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 217 ms / 2,000 ms
コード長 1,031 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 414 ms
コンパイル使用メモリ 82,224 KB
実行使用メモリ 115,948 KB
最終ジャッジ日時 2025-11-01 15:10:20
合計ジャッジ時間 5,450 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
sys.setrecursionlimit(5*10**7)
import math
import bisect
import heapq
from collections import deque, defaultdict 
import random
import itertools
#from decimal import Decimal
#from copy import copy, deepcopy
#from sortedcontainers import SortedList

# -------------------------------------------------
pin = sys.stdin.readline
def ST(): return pin().rstrip()
def IN(): return int(pin())
def IM(): return map(int, pin().split())
def IL(): return list(IM())
def SR(n:int)->list: return [pin().rstrip() for _ in range(n)]
def IMatrix(n:int)->list: return [IL() for _ in range(n)]

INF = 2*10**18+1
mod = 998244353
# -------------------------------------------------
#import pypyjit
#pypyjit.set_param("max_unroll_recursion=-1")

N, M = IM()
A = IL() + [INF]

if M == 1:
	print(1)
	print(A[0], 1)
	exit()
	
ans = []

now = A[0]
cnt = 1

for i in range(1, M+1):
    if A[i]-cnt == now:
        cnt += 1
    else:
        ans.append((now, cnt))
        now = A[i]
        cnt = 1

print(len(ans))
for i, j in ans:
	print(i, j)
0