結果
問題 | No.3094 Stapler |
ユーザー |
![]() |
提出日時 | 2025-04-07 16:56:54 |
言語 | cLay (20241019-1) |
結果 |
AC
|
実行時間 | 55 ms / 2,000 ms |
コード長 | 834 bytes |
コンパイル時間 | 3,318 ms |
コンパイル使用メモリ | 191,156 KB |
実行使用メモリ | 34,188 KB |
最終ジャッジ日時 | 2025-06-20 02:33:36 |
合計ジャッジ時間 | 7,537 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 72 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:312:11: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 312 | auto[l,r]=qs[q]; | ^
ソースコード
struct N{ int v; int l; int r; }; N segtree_ph_func(N a,N b){ N r; if(a.r<b.l){ r.v=b.v; r.l=a.l+b.l-a.r; r.r=b.r; }else if(a.r>b.l){ r.v=a.v; r.l=a.l; r.r=b.r+a.r-b.l; }else{ r.v=a.v+b.v; r.l=a.l; r.r=b.r; } return r; } { segtree_ph<N>t; ll@n,@q; pair<ll,ll>qs[q]; t.malloc(n,1); rep(i,n){ t[i].v=1; t[i].l=0; t[i].r=0; } t.build(); rep(i,q){ ll@c; if(c==1){ ll@l--,@r--; qs[i]={l,r}; if(l<r){ { N a=t[l]; a.r+=1; a.v=0; t.change(l,a); } { N a=t[r]; a.l+=1; t.change(r,a); } } } if(c==2){ ll@q--; auto [l,r]=qs[q]; if(l<r){ { N a=t[l]; a.r-=1; a.v=a.r==0; t.change(l,a); } { N a=t[r]; a.l-=1; t.change(r,a); } } } if(c==3){ wt(t.get(0,n).v); } } }