2950 Assault Exams

Source: Internet
Author: User

2950 Assault Exams

time limit: 1 sspace limit: 128000 KBtitle level: Golden Gold SolvingView Run ResultsTitle Description Description

One day, the professor decided to take an assault exam. Everyone has a Test level, the classroom has a total of n desks, in order in a row, each desk can sit two people, remember their ability level is (A[i],b[i]). Now the professor decided to test the person with the ability to grade K. He would select a continuous l row from the N row for the quiz, requiring at least one person in each row of the L row to have a test grade of K. Now we want to know the maximum value of L and the corresponding grade K.

Enter a description Input Description

Line 1th: An integer, N

2nd.. N+1 line: 2 integers per line, representing A[i],b[i]

Output description Output Description

Line 1th: 2 integers, l,k, requires K minimum under L maximum condition.

Sample input Sample Input

3

3 5

4 5

1 3

Sample output Sample Output

2 5

Data range and Tips Data Size & Hint

1≤n≤100000,1≤a[i],b[i]≤5

Category labels Tags Click here to expand
#include <cstdio>#include<iostream>using namespacestd;structnode{intXinty;} e[110000];intMain () {intn,k,ans=0; scanf ("%d",&N);  for(intI=1; i<=n;i++) {scanf ("%d%d",&e[i].x,&e[i].y); }     for(intI=1; i<=5; i++) {//1≤a[i],b[i]≤5        intt=0;  for(intj=1; j<=n;j++){            if(e[j].x==i| | e[j].y==i) t++;//Enumeration            Elset=0; if(T>ans) {//Save current Best Practicesans=T; K=i; }}} printf ("%d%d\n", ans,k); return 0;}

2950 Assault Exams

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.