結果
問題 | No.3091 The Little Match Boy |
ユーザー |
|
提出日時 | 2025-04-16 02:09:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 18 ms / 2,000 ms |
コード長 | 523 bytes |
コンパイル時間 | 2,467 ms |
コンパイル使用メモリ | 200,024 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-16 02:09:32 |
合計ジャッジ時間 | 4,665 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 62 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, m, p; cin >> n >> m; vector<int> b(n); iota(b.begin(), b.end(), 0); vector<long long> S(m); while(m--){ cin >> p, p--; S[m] = b[p] < b[p + 1] ? ((long long)(b[p]) << 17) | b[p + 1] : ((long long)(b[p + 1]) << 17) | b[p]; swap(b[p], b[p + 1]); } sort(S.begin(), S.end()); S.erase(unique(S.begin(), S.end()), S.end()); cout << S.size() << '\n'; }