結果

問題 No.3324 ハイライト動画
コンテスト
ユーザー hatsuka_iwa
提出日時 2025-11-10 03:04:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 336 ms / 2,000 ms
コード長 427 bytes
コンパイル時間 2,041 ms
コンパイル使用メモリ 200,932 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-11-10 03:04:29
合計ジャッジ時間 7,402 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, M; cin >> N >> M;
  vector<int> A(M); for (int &B : A) cin >> B;
  vector<pair<int, int>> Ans;
  for (int i = 0; i < M; i++) {
    int j = 1;
    while (i + j < M && A.at(i + j) == A.at(i) + j) j++;
    Ans.push_back({A.at(i), j});
    i += j - 1;
  }
  cout << Ans.size() << endl;
  for (pair<int, int> P : Ans) cout << P.first << ' ' << P.second << endl;
}
0