結果
| 問題 | No.3091 The Little Match Boy |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-18 16:10:17 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 2,000 ms |
| + 16µs | |
| コード長 | 484 bytes |
| 記録 | |
| コンパイル時間 | 1,080 ms |
| コンパイル使用メモリ | 219,480 KB |
| 実行使用メモリ | 7,168 KB |
| 最終ジャッジ日時 | 2026-07-19 15:33:41 |
| 合計ジャッジ時間 | 5,633 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}