結果

問題 No.2596 Christmas Eve (Heuristic ver.)
ユーザー 👑 p-adic
提出日時 2023-12-24 16:20:16
言語 cLay
(20241019-1)
結果
AC  
実行時間 1,145 ms / 1,224 ms
コード長 1,956 bytes
コンパイル時間 3,575 ms
コンパイル使用メモリ 201,928 KB
実行使用メモリ 6,676 KB
スコア 2,809,257
最終ジャッジ日時 2023-12-24 16:22:34
合計ジャッジ時間 137,942 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 125
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:285:14: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
  285 |         auto&[h,V]=*O.begin();
      |              ^
main.cpp:298:14: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
  298 |         auto&[h,V]=*O.begin();
      |              ^
main.cpp:311:14: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
  311 |         auto&[h,V]=*O.rbegin();
      |              ^
main.cpp:324:14: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
  324 |         auto&[h,V]=*O.rbegin();
      |              ^
main.cpp:340:14: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
  340 |         auto&[h,V]=*O.begin();
      |              ^
main.cpp:353:14: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
  353 |         auto&[h,V]=*O.rbegin();
      |              ^
main.cpp:370:12: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
  370 |       auto&[h,V]=*O.begin();
      |            ^
main.cpp:383:12: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
  383 |       auto&[h,V]=*O.rbegin();
      |            ^
main.cpp:399:10: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
  399 |     auto&[h,V]=*j++;
      |          ^

ソースコード

diff #

#define I insert
#define D erase
#define S second
#define V 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],H;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);}rep(1d2){REP(n,6d5){if(n%4>2){auto&[h,V]=*O.begin();auto s=C.U({a[2N+v],2N}),e=C.end();if(s!=e)if(h<(H=h-a[4N+v]+a[4N+s->S])<L)O.I({H,u,s->S,w,x}),C.I({a[2N+v],v}),O.D({h,V}),C.D(s);}else if(n%2){auto&[h,V]=*O.begin();auto t=C.U({a[2N+w],2N}),e=C.end();if(t!=e)if(h<(H=h-a[4N+w]+a[4N+t->S])<L)O.I({H,u,v,t->S,x}),C.I({a[2N+w],w}),O.D({h,V}),C.D(t);}else if(n%4){auto&[h,V]=*O.rbegin();auto s=C.U({a[2N+v],2N}),e=C.end();if(s!=e)if(l<(H=h-a[4N+v]+a[4N+s->S])<h)O.I({H,u,s->S,w,x}),C.I({a[2N+v],v}),O.D({h,V}),C.D(s);}else{auto&[h,V]=*O.rbegin();auto t=C.U({a[2N+w],2N}),e=C.end();if(t!=e)if(l<(H=h-a[4N+w]+a[4N+t->S])<h)O.I({H,u,v,t->S,x}),C.I({a[2N+w],w}),O.D({h,V}),C.D(t);}}REP(n,2d5){if(n%2){auto&[h,V]=*O.begin();auto s=A.U({a[u],N}),e=A.end();if(s!=e)if(h<(H=h-a[N+u]+a[N+s->S])<L&&a[s->S]<min(a[2N+v],a[2N,w]))O.I({H,s->S,v,w,x}),A.I({a[u],u}),O.D({h,V}),A.D(s);}else{auto&[h,V]=*O.rbegin();auto t=A.U({a[u],2N}),e=A.end();if(t!=e)if(l<(H=h-a[N+u]+a[N+t->S])<h&&a[t->S]<min(a[2N+v],a[2N,w]))O.I({H,t->S,v,w,x}),A.I({a[u],u}),O.D({h,V}),A.D(t);}}}REP(n,1d5){if(n%2){auto&[h,V]=*O.begin();auto s=E.U({a[6N+x],N}),e=E.end();if(s!=e)if(h<(H=h-a[7N+x]+a[7N+s->S])<L&&a[6N+s->S]<a[u])O.I({H,u,v,w,s->S}),E.I({a[6N+x],x}),O.D({h,V}),E.D(s);}else{auto&[h,V]=*O.rbegin();auto t=E.U({a[6N+x],N}),e=E.end();if(t!=e)if(l<(H=h-a[7N+x]+a[7N+t->S])<h&&a[6N+t->S]<a[u])O.I({H,u,v,w,t->S}),E.I({a[x],x}),O.D({h,V}),E.D(t);}}auto j=O.begin(),e=O.end();while(j!=e){auto&[h,V]=*j++;wt(u+1,v+1,w+1,x+1);}
0