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