結果
| 問題 |
No.3091 The Little Match Boy
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-06 15:32:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 44 ms / 2,000 ms |
| コード長 | 403 bytes |
| コンパイル時間 | 884 ms |
| コンパイル使用メモリ | 71,484 KB |
| 実行使用メモリ | 7,296 KB |
| 最終ジャッジ日時 | 2025-04-06 15:32:17 |
| 合計ジャッジ時間 | 4,893 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 62 |
ソースコード
#include<iostream>
#include<set>
#include<vector>
#include<cassert>
using namespace std;
int N,M;
int P[1<<17];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>N>>M;
for(int i=0;i<N;i++)P[i]=i;
set<pair<int,int> >ans;
for(int i=0;i<M;i++)
{
int s;cin>>s;s--;
int u=P[s],v=P[s+1];
ans.insert(make_pair(min(u,v),max(u,v)));
swap(P[s],P[s+1]);
}
cout<<ans.size()<<endl;
}