結果
| 問題 | No.3091 The Little Match Boy |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-22 20:04:01 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 395 bytes |
| 記録 | |
| コンパイル時間 | 1,142 ms |
| コンパイル使用メモリ | 215,644 KB |
| 実行使用メモリ | 8,704 KB |
| 最終ジャッジ日時 | 2026-07-10 22:38:34 |
| 合計ジャッジ時間 | 4,746 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 51 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3fLL;
const int MAX=2e5+10;
int p[MAX];
int main()
{
int n,m,i,x;
scanf("%d%d",&n,&m);
for(i=1;i<=n;i++) p[i]=i;
set<pair<int,int>> s;
for(i=1;i<=m;i++)
{
scanf("%d",&x);
s.insert({p[x],p[x+1]});
swap(p[x],p[x+1]);
}
printf("%d\n",s.size()/2);
return 0;
}