1279 Throwing dishes

Source: Internet
Author: User

Idea: First the wellhead is processed into an ascending sequence, and then two points are inserted in each plate position.

1#include <iostream>2#include <queue>3#include <stack>4#include <cstdio>5#include <vector>6#include <map>7#include <Set>8#include <bitset>9#include <algorithm>Ten#include <cmath> One#include <cstring> A#include <cstdlib> -#include <string> -#include <sstream> the#include <time.h> - #defineX First - #defineY Second - #definePB Push_back + #defineMP Make_pair - #defineLson l,m,rt*2 + #defineRson m+1,r,rt*2+1 A #defineMT (A, b) memset (a,b,sizeof (A)) at #defineMoD 1000000007 - using namespacestd; -typedefLong LongLL; - Const DoublePI = ACOs (-1); - Const intn=1e5+Ten; - Const intINF =0x3f3f3f3f; in ConstLL inf=0x3f3f3f3f3f3f3f3fll; - intW[n],d[n]; to intMain () + { - #ifdef Local theFreopen ("Data.txt","R", stdin); * #endif $     intn,m,ans=0;Panax NotoginsengCin>>n>>m; -      for(intI=0; i<n;i++) cin>>W[i]; the      for(intI=0; i<m;i++) cin>>D[i]; +      for(intI=1; i<n;i++) A     { the         if(w[i]>w[i-1]) w[i]=w[i-1]; +     } -Sort (w,w+n); $w[n]=inf; $      for(intI=0, k=0; i<m;i++) -     { -K=lower_bound (w+k,w+n+1, D[i])-w+1; the         if(k>n) Break; -ans++;Wuyi     } thecout<<ans<<Endl; - #ifdef Local WuCerr <<"Time :"<< (LL) clock () * +/Clocks_per_sec <<"Ms"<<Endl; - #endif About}
View Code

1279 Throwing dishes

Related Keywords:

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.