結果

問題 No.2596 Christmas Eve (Heuristic ver.)
ユーザー 👑 p-adic
提出日時 2023-12-26 01:42:06
言語 cLay
(20241019-1)
結果
AC  
実行時間 362 ms / 1,224 ms
コード長 1,011 bytes
コンパイル時間 3,714 ms
コンパイル使用メモリ 202,824 KB
実行使用メモリ 6,676 KB
スコア 4,952,703
最終ジャッジ日時 2023-12-26 01:42:53
合計ジャッジ時間 45,883 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 125
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:341:12: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
  341 |       auto&[V]=*O.begin();
      |            ^
main.cpp:345:12: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
  345 |       auto&[V]=*O.rbegin();
      |            ^
main.cpp:365:10: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
  365 |     auto&[V]=*j++;
      |          ^

ソースコード

diff #

#define I insert
#define D erase
#define S second
#define V h,u,v,w,x
#define U upper_bound
#define l get<0>(*O.begin())
#define L get<0>(*O.rbegin())
ll@N,@K,@a[8N],p;set<pair<ll,ll>>A,C,E;rep(i,N)A.I({a[i],i}),C.I({a[2N+2i],2i}),C.I({a[2N+2i+1],2i+1}),E.I({a[6N+i],i});set<tuple<ll,ll,ll,ll,ll>>O;rep(K){auto x=E.begin(),u=A.U({x->first,N}),w=C.U({u->first,2N}),v=w++;O.I({a[N+u->S]+a[4N+v->S]+a[4N+w->S]+a[7N+x->S],u->S,v->S,w->S,x->S});A.D(u),C.D(v),C.D(w),E.D(x);}vector<ll>c,d,s={N,4N,4N,7N},t={0,2N,2N,6N};decltype(A)*P[4]={&A,&C,&C,&E};Rand R;rep(n,3d5){if(n%2){auto&[V]=*O.begin();c={V};}else{auto&[V]=*O.rbegin();c={V};}d=c;p=R.get()%4;auto j=P[p]->begin();REP(R.get()%P[p]->size())j++;if(l<(d[0]=c[0]-a[s[p]+c[p+1]]+a[s[p]+(d[p+1]=j->S)])<L?a[6N+d[4]]<a[d[1]]<min(a[2N+d[2]],a[2N+d[3]]):false){O.I({d[0],d[1],d[2],d[3],d[4]}),P[p]->I({a[t[p]+c[p+1]],c[p+1]}),O.D({c[0],c[1],c[2],c[3],c[4]}),P[p]->D({a[t[p]+d[p+1]],d[p+1]});}}auto j=O.begin(),e=O.end();while(j!=e){auto&[V]=*j++;wt(u+1,v+1,w+1,x+1);}
0