結果

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

ソースコード

diff #

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int N,M; cin >> N >> M;
    vector<pair<int,int>> answer;
    int back = -1,streak = 0;
    while(M--){
        int a; cin >> a;
        if(back+streak != a){
            if(back != -1) answer.push_back({back,streak});
            back = a,streak = 1;
        }
        else streak++;
    }
    answer.push_back({back,streak});
    cout << answer.size() << "\n";
    for(auto [s,l] : answer) cout << s << " " << l << endl;
}
0