結果
| 問題 | No.3091 The Little Match Boy |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-18 16:10:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 72 ms / 2,000 ms |
| コード長 | 484 bytes |
| 記録 | |
| コンパイル時間 | 2,042 ms |
| コンパイル使用メモリ | 200,376 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-18 16:10:24 |
| 合計ジャッジ時間 | 6,459 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 62 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
vector<int> nums(n);
for(int i = 0;i<n;i++){
nums[i] = i;
}
set<pair<int,int>> count;
for(int i = 0;i<m;i++){
int a;
cin >> a;
a--;
int s = nums[a],t = nums[a+1];
if(s>t) swap(s,t);
count.insert({s,t});
//cout << s << " " << t << endl;
swap(nums[a],nums[a+1]);
}
cout << count.size() << endl;
}