結果

問題 No.3324 ハイライト動画
コンテスト
ユーザー 👑 loop0919
提出日時 2025-03-05 12:40:01
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 317 ms / 2,000 ms
コード長 519 bytes
コンパイル時間 2,411 ms
コンパイル使用メモリ 281,088 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-11-01 14:30:28
合計ジャッジ時間 6,068 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 i = 0; i < M; i++) {
        cin >> A[i];
    }

    vector<pair<int, int>> ans{{A[0], 1}};
    
    for (int i = 0; i < M - 1; i++) {
        if (A[i + 1] == A[i] + 1) {
            ans.back().second++;
        } else {
            ans.push_back({A[i + 1], 1});
        }
    }

    cout << ans.size() << endl;
    for (auto &[s, l] : ans) {
        cout << s << " " << l << endl;
    }
}
0