結果

問題 No.2740 Old Maid
ユーザー 👑 p-adic
提出日時 2024-04-21 19:56:53
言語 cLay
(20241019-1)
結果
AC  
実行時間 347 ms / 2,000 ms
コード長 250 bytes
コンパイル時間 2,653 ms
コンパイル使用メモリ 186,804 KB
実行使用メモリ 30,336 KB
最終ジャッジ日時 2024-10-13 18:39:28
合計ジャッジ時間 15,716 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 62
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@N,@p[N],q[N],s,t;set<ll>I;set<pair<ll,ll>>S;rep(i,N)I.insert(i),S.insert({p[i],i});rep(n,N/2){auto j=S.begin();j->second<*I.rbegin()?j:++j;I.erase(s=j->second);I.erase(t=*I.upper_bound(s));S.erase(j);S.erase({q[2n+1]=p[t],t});q[2n]=p[s];}wt(q(N));
0