結果

問題 No.3324 ハイライト動画
コンテスト
ユーザー nou
提出日時 2026-09-15 11:21:25
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 65 ms / 2,000 ms
+ 66µs
コード長 618 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,698 ms
コンパイル使用メモリ 172,064 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-15 11:21:32
合計ジャッジ時間 5,642 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/bits/stl_algobase.h:63,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/string:55,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/bits/locale_classes.h:43,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/bits/ios_base.h:43,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/ios:46,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/bits/ostream.h:43,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/ostream:42,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/iostream:43,
                 from main.cpp:1:
In constructor 'constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = int&; _U2 = int&; _T1 = int; _T2 = int]',
    inlined from 'constexpr _Tp* std::construct_at(_Tp*, _Args&& ...) [with _Tp = pair<int, int>; _Args = {int&, int&}]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/bits/stl_construct.h:110:9,
    inlined from 'static constexpr void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::pair<int, int>; _Args = {int&, int&}; _Tp = std::pair<int, int>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/bits/alloc_traits.h:716:21,
    inlined from 'constexpr void std::vector< <template-parameter-1-1>, <template-parameter-1-2> >::_M_realloc_append(_Args&& ...) [with _Args = {int&, int&}; _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/bits/vector.tcc:594:26,
    inlined from 'constexpr std::vector< <template-parameter-1-1>, <template-parameter-1-2> >::reference std::vector< <template-parameter-1-1>, <template-parameter-1-2> >::emplace_back(_Args&& ...) [with _Args = {int

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    int a, p, s, l;
    vector<pair<int, int>> v;
    for (int i = 0; i < m; i++) {
        cin >> a;
        if (i == 0) {
            p = a;
            s = a;
            l = 1;
            continue;
        }
        if (a-p == 1) l++;
        else {
            v.emplace_back(s, l);
            s = a;
            l = 1;
        }
        p = a;
    }
    v.emplace_back(s, l);
    cout << v.size() << endl;
    for (auto [s, l]: v)
        cout << s << " " << l << "\n";
    return 0;
}
0