結果
| 問題 | No.3091 The Little Match Boy |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-05-22 20:09:00 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 432 bytes |
| 記録 | |
| コンパイル時間 | 1,110 ms |
| コンパイル使用メモリ | 215,264 KB |
| 実行使用メモリ | 7,424 KB |
| 最終ジャッジ日時 | 2026-07-10 22:38:48 |
| 合計ジャッジ時間 | 4,282 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 62 |
ソースコード
#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,y,z;
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",&z);
x=p[z];
y=p[z+1];
if(x>y) swap(x,y);
s.insert({x,y});
swap(p[z],p[z+1]);
}
printf("%d\n",s.size());
return 0;
}
vjudge1