Codeforces 493 C Vasya and Basketball

Source: Internet
Author: User

Test instructions: Give the value of the three-line d, respectively, there are two teams, if less than or equal to D, 2 points, if greater than D, three points, asked to make a-B max

As soon as I see the title, I take it for granted that----nothing.---55555555

Only later know can not be two points, because with the increase of D, two teams will gradually reduce the score, but two teams of the difference in the value of the monotony but do not know

This is the http://www.cnblogs.com/huangxf/p/4142760.html of this story.

Then enumerate the values of D in turn, maintaining a maximum value

1#include <iostream>2#include <cstdio>3#include <cstring>4#include <cmath>5#include <stack>6#include <vector>7#include <map>8#include <Set>9#include <queue>Ten#include <algorithm> One using namespacestd; A  -typedefLong LongLL; - Const intINF = (1<< -)-1; the Const intMod=1000000007; - Const intmaxn=1000005; -  - intn,m; + intA[MAXN],B[MAXN],C[MAXN]; -  + intMain () { A     intCnt=0; atc[++cnt]=0; -scanf"%d",&n); -      for(intI=0; i<n;i++) scanf ("%d", &a[i]), c[++cnt]=A[i]; -scanf"%d",&m); -      for(intI=0; i<m;i++) scanf ("%d", &b[i]), c[++cnt]=B[i]; -      inSort (a,a+n); -Sort (b,b+m); toSort (c,c+CNT); +     inttmp=-Inf,l,r; -  the     intLb,ub; *      for(intI=1; i<=cnt;i++){ $         intX=upper_bound (A,a+n,c[i])-A;Panax Notoginseng         intY=upper_bound (B,b+m,c[i])-b; -          theLB = x*2+ (n-x) *3; +UB = y*2+ (m-y) *3; A         if(Lb-ub >tmp) { thetmp=lb-UB; +l=lb; R=UB; -         } $         if(Lb-ub = = tmp && lb > L) L =lb; $     } -printf"%d:%d\n", l,r); -     return 0; the}
View Code

Codeforces 493 C Vasya and Basketball

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.