結果

問題 No.3324 ハイライト動画
コンテスト
ユーザー Rumain831
提出日時 2025-11-01 15:07:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 322 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 833 ms
コンパイル使用メモリ 80,872 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-11-01 15:08:01
合計ジャッジ時間 4,820 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;

int main(void){
  int n, m; cin >> n >> m;
  vector<pair<int, int>> ans;
  vector<int> a(m);
  for(auto&x:a) cin >> x;
  int id=0, st, ed;
  while(id<m){
    st=a[id], ed=a[id];
    while(id+1<m&&a[id+1]==a[id]+1) id++, ed=a[id];
    ans.emplace_back(st, ed-st+1);
    id++;
  }
  cout << ans.size() << endl;
  for(auto [p, q]:ans) cout << p << ' ' << q << endl;
  return 0;
}
0