結果

問題 No.3091 The Little Match Boy
ユーザー nu50218
提出日時 2025-04-06 16:13:36
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 803 bytes
コンパイル時間 4,032 ms
コンパイル使用メモリ 301,472 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-06 16:13:43
合計ジャッジ時間 6,894 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 60
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifdef LOCAL
#include <local.hpp>
#else
#pragma GCC optimize("O3")
// #pragma target("arch=skylake-avx512")
#include <bits/stdc++.h>
#define debug(...) ((void)0)
#endif

using namespace std;
using ll = long long;
using ld = long double;

void solve(int) {
    int N, M;
    cin >> N >> M;

    set<pair<int, int>> s;
    vector<int> A(N);
    iota(A.begin(), A.end(), 1);

    for (int i = 0; i < M; i++) {
        int S;
        cin >> S;
        S--;

        int x = A[S];
        int y = A[S + 1];
        if (x > y) swap(x, y);
        s.insert({x, y});
    }

    cout << s.size() + 1 << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) {
        solve(i);
    }

#ifdef LOCAL
    postprocess();
#endif
}
0