結果

問題 No.3091 The Little Match Boy
ユーザー GOTKAKO
提出日時 2025-04-08 00:38:06
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 2,474 ms
コンパイル使用メモリ 199,228 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-08 00:38:14
合計ジャッジ時間 7,572 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 62
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    int N,M; cin >> N >> M;
    set<pair<int,int>> S;
    vector<int> P(N);
    iota(P.begin(),P.end(),0);
    while(M--){
        int s; cin >> s; s--;
        int &p = P.at(s),&q = P.at(s+1);
        swap(p,q);
        S.insert({min(p,q),max(p,q)});
    }

    cout << S.size() << endl;
}
0