結果
| 問題 |
No.3091 The Little Match Boy
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-16 02:04:06 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 2,000 ms |
| コード長 | 501 bytes |
| コンパイル時間 | 4,373 ms |
| コンパイル使用メモリ | 256,212 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-16 02:04:14 |
| 合計ジャッジ時間 | 7,742 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 62 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n, m, p;
cin >> n >> m;
vector<pair<int,int>> S;
vector<int> b(n);
iota(b.begin(), b.end(), 0);
for(int i = 0; i < m; i++){
cin >> p, p--;
S.emplace_back(minmax(b[p], b[p + 1]));
swap(b[p], b[p + 1]);
}
sort(S.begin(), S.end());
S.erase(unique(S.begin(), S.end()), S.end());
cout << S.size() << '\n';
}