{"id":267,"date":"2024-06-28T22:35:02","date_gmt":"2024-06-28T14:35:02","guid":{"rendered":"http:\/\/www.heartwarming.online:8003\/?p=267"},"modified":"2024-06-28T22:35:04","modified_gmt":"2024-06-28T14:35:04","slug":"%e5%8f%8c%e9%93%be%e8%a1%a8","status":"publish","type":"post","link":"https:\/\/blog.heartwarming.online\/index.php\/2024\/06\/28\/%e5%8f%8c%e9%93%be%e8%a1%a8\/","title":{"rendered":"\u53cc\u94fe\u8868"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u672c\u8d28\uff1a<\/h2>\n\n\n\n<p>\u53cc\u94fe\u8868\u540c\u5355\u94fe\u8868\u539f\u7406\u51e0\u4e4e\u4e00\u81f4\uff0c\u53ea\u662f\u53cc\u94fe\u8868\u7684\u6307\u9488\u9009\u9879\u4e3a\u4e24\u9879\uff0cl[i]\u548cr[i],\u4f46\u5176\u4e2d\u7684\u672c\u8d28\u51e0\u4e4e\u4e0d\u53d8\uff0c\u64cd\u4f5c\u601d\u60f3\u4e0d\u53d8\u3002<\/p>\n\n\n\n<p>\u5176\u4e2d\u75280\u8868\u793a\u5934\u8282\u70b9\u5750\u6807\uff0c1\u8868\u793a\u7ed3\u5c3e\u7ed3\u70b9\u5750\u6807<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/blog.heartwarming.online\/wp-content\/uploads\/2024\/06\/image-16.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1000\" height=\"600\" data-original=\"https:\/\/blog.heartwarming.online\/wp-content\/uploads\/2024\/06\/image-16.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-268\"  sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u73b0\u90e8\u5206\uff1a<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1\u3001\u5728\u7ed3\u70b9a\u7684\u53f3\u8fb9\u63d2\u5165\u4e00\u4e2a\u6570x<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>void insert(int a,int x)<br>{<br> &nbsp; &nbsp;  e&#91;idx]=x;<br> &nbsp; &nbsp;  r&#91;idx]=r&#91;a];<br> &nbsp; &nbsp;  l&#91;r&#91;a]]=idx;<br> &nbsp; &nbsp;  l&#91;idx]=a;<br> &nbsp; &nbsp;  r&#91;a]=idx++;<br>}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2\u3001\u5220\u9664\u7ed3\u70b9a<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>void remove(int a)<br>{<br> &nbsp; &nbsp; l&#91;r&#91;a]]=l&#91;a];<br> &nbsp; &nbsp; r&#91;l&#91;a]]=r&#91;a];<br>}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801\u5b9e\u73b0\uff1a<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream&gt;<br>using namespace std;<br>const int N=100010;<br>int m,e&#91;N],l&#91;N],r&#91;N],idx;<br>\u200b<br>int main()<br>{<br> &nbsp;  cin&gt;&gt;m;<br> &nbsp;  r&#91;0]=1;<br> &nbsp;  l&#91;1]=0;<br> &nbsp;  while(m--)<br> &nbsp;  {<br> &nbsp;  string op;<br> &nbsp;  cin&gt;&gt;op;<br> &nbsp; &nbsp; &nbsp; int k,x;<br> &nbsp; &nbsp; &nbsp; if(op==\"L\")<br> &nbsp; &nbsp; &nbsp; {<br> &nbsp; &nbsp; &nbsp; cin&gt;&gt;x;<br> &nbsp; &nbsp; &nbsp; insert(0,x);<br> &nbsp; &nbsp; &nbsp; }<br> &nbsp; &nbsp; &nbsp; else if(op==\"R\")<br> &nbsp; &nbsp; &nbsp; {<br> &nbsp; &nbsp; &nbsp; cin&gt;&gt;x;<br> &nbsp; &nbsp; &nbsp; insert(l&#91;1],x);<br> &nbsp; &nbsp; &nbsp; }<br> &nbsp; &nbsp; &nbsp; else if(op==\"IL\")<br> &nbsp; &nbsp; &nbsp; {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin&gt;&gt;K&gt;&gt;x;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; insert(l&#91;k+1],x);<br> &nbsp; &nbsp; &nbsp; }<br> &nbsp; &nbsp; &nbsp; else{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin&gt;&gt;k&gt;&gt;x;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; insert(k+1,x);<br> &nbsp; &nbsp; &nbsp; }<br> &nbsp;  }<br> &nbsp;  for(int i-0;i!=1;i=r&#91;i])<br> &nbsp;  {<br> &nbsp; &nbsp; &nbsp; cout&lt;&lt;e&#91;i]&lt;&lt;' ';<br> &nbsp;  }<br> &nbsp;  cout&lt;&lt;endl;<br> &nbsp; return 0;<br>}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u8d28\uff1a \u53cc\u94fe\u8868\u540c\u5355\u94fe\u8868\u539f\u7406\u51e0\u4e4e\u4e00\u81f4\uff0c\u53ea\u662f\u53cc\u94fe\u8868\u7684\u6307\u9488\u9009\u9879\u4e3a\u4e24\u9879\uff0cl[i]\u548cr[i],\u4f46\u5176\u4e2d\u7684\u672c\u8d28\u51e0\u4e4e\u4e0d\u53d8\uff0c\u64cd\u4f5c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4,32],"tags":[30],"class_list":["post-267","post","type-post","status-publish","format-standard","hentry","category-blog","category-32","tag-30"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/blog.heartwarming.online\/index.php\/wp-json\/wp\/v2\/posts\/267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.heartwarming.online\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.heartwarming.online\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.heartwarming.online\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.heartwarming.online\/index.php\/wp-json\/wp\/v2\/comments?post=267"}],"version-history":[{"count":1,"href":"https:\/\/blog.heartwarming.online\/index.php\/wp-json\/wp\/v2\/posts\/267\/revisions"}],"predecessor-version":[{"id":269,"href":"https:\/\/blog.heartwarming.online\/index.php\/wp-json\/wp\/v2\/posts\/267\/revisions\/269"}],"wp:attachment":[{"href":"https:\/\/blog.heartwarming.online\/index.php\/wp-json\/wp\/v2\/media?parent=267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.heartwarming.online\/index.php\/wp-json\/wp\/v2\/categories?post=267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.heartwarming.online\/index.php\/wp-json\/wp\/v2\/tags?post=267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}