結果
問題 | No.3091 The Little Match Boy |
ユーザー |
![]() |
提出日時 | 2025-04-06 15:34:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 73 ms / 2,000 ms |
コード長 | 361 bytes |
コンパイル時間 | 1,921 ms |
コンパイル使用メモリ | 200,300 KB |
実行使用メモリ | 8,192 KB |
最終ジャッジ日時 | 2025-04-06 15:34:13 |
合計ジャッジ時間 | 5,154 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 62 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int N,M; cin>>N>>M; vector<int> A(N); set<pair<int,int>> s; for(int i=0;i<N;i++) A[i] = i; for(int i=0;i<M;i++){ int a; cin>>a; if(!s.count({A[a],A[a-1]})) s.insert({A[a-1],A[a]}); swap(A[a-1],A[a]); } cout<<s.size()<<endl; }