


/*Title*/
Tips: given n, m, and then an array nnum containing m numbers, the array defaults from small to large Sorting, then n operations, input a number x, if x is 0, add 0 to the end of the string, if x is 1, add 1 to the end of the string, if x is -1, then Delete the subscripts in the string that are equal to the elements in the nnum array. The string is empty at the beginning. What is in the last string? If it is empty, output POOR STACK
. Looking at this operation, it is usually easy to think of line segment trees and tree arrays. I built a tree array at the beginning, but it timed out. After all, there are many operations, and in the deletion operation, if the nnum array is very large, it is equivalent to 10^ The complexity of 12 can only be optimized. Generally speaking, it is divided into two. A tree array is directly established based on whether a certain position of the string is empty. Needless to say, it is added at the end each time. Just add it directly. The key is To delete, first delete, the first step is to use binary search to find the last digit to be deleted. For example, the length of the string is 7, and there is 8 in the nnum array. In fact, the position 8 does not need to be deleted, but this still times out, so I thought that when deleting in a tree array, it also needs to be divided into two parts, but I kept writing it wrong. Later, I learned from Jie Ge's discovery and found that WA is here. For example, the current string is 01010, and the characters at positions 1, 3, and 4 need to be deleted. It takes turns. When you delete position 1, the string becomes 1010. You also need to delete the status of node 1 in the tree array, so the original position 3 becomes position 2. When you delete No. 3, it becomes 110, and the original No. 4 position becomes No. 2, so every time you delete it, the subscript will change, but it’s okay. I found that after several operations before, your original subscript It is a few less than the current one, so nnum[i] - i is actually the position of the element that needs to be deleted in the tree array
int n,m;int c[1000000 + 55];int nnum[1000000 + 55];int aa[1000000 + 55];int sum[1000000 + 55];int len;void init() { memset(c,0,sizeof(c)); memset(aa,-1,sizeof(aa));}bool input() { while(cin>>n>>m) { for(int i=0;i<m>>nnum[i]; return false; } return true;}int lowbit(int x) { return x&(-x);}void add(int i,int val) { while(i 0) { sum += c[i]; i -= lowbit(i); } return sum;}void binary_find(int pos,int id) { int l = 1; int r = n; while(l >1; int ret = get_sum(mid); if(aa[mid] == -1) { if(ret >= nnum[pos] - id) r = mid - 1; else l = mid + 1; } else if(ret == nnum[pos] - id) { add(mid,-1); aa[mid] = -1; len--; break; } else if(ret > nnum[pos] - id) r = mid - 1; else if(ret >type; if(type == -1) { if(len == 0)continue; if(nnum[0] > len)continue; int now = lower_bound(nnum,nnum + m,len) - nnum; for(int i=0;i <br> <br> <p></p> <p><br> </p> </m>

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools

Atom editor mac version download
The most popular open source editor