HDU Bombing (STL multiset + map)

Source: Internet
Author: User


N coordinates (x, y) and m (c, d)


C = 0, find the number of x = d and delete these points;

C = 1, find the number of y = d and delete these points.


Multi- ing of map + multiset


# Include
 
  
# Include
  
   
# Include
   
    
# Include
    
     
# Include
     # Include
      
        # Include
       
         # Include
        
          # Include
         
           # Include
          
            Using namespace std; # define inf 1e8 # define eps 1e-8 # define ll _ int64 # define maxn 100001 # define mol %7map
           
             > X, Y; int main () {int n, m; while (scanf ("% d", & n, & m) & n & m) {int x, y, c, d; X. clear (); Y. clear (); // multiset
            
              : Iterator it; while (n --) {scanf ("% d", & x, & y); X [x]. insert (y); Y [y]. insert (x) ;}while (m --) {scanf ("% d", & c, & d); if (c = 0) {multiset
             
               : Iterator it; printf ("% d \ n", X [d]. size (); for (it = X [d]. begin (); it! = X [d]. end (); it ++) // Delete the number of y x = d. Y [* it]. erase (d); X [d]. clear ();} else {multiset
              
                : Iterator it; printf ("% d \ n", Y [d]. size (); for (it = Y [d]. begin (); it! = Y [d]. end (); it ++) // Delete the x number of y = d X [* it]. erase (d); Y [d]. clear () ;}} printf ("\ n") ;}return 0 ;}
              
             
            
           
          
         
        
       
      
    
   
  
 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.