Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

AC (/≧▽≦)/

Posted by 1243295518 at 2019-02-27 22:34:42 on Problem 1083
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<string.h>
#include<map>
#include<math.h>
#include<vector>
#include<queue>
#include<stack>
#define inf 99999999
using namespace std;
int t,m,a,b,occ[210];
int f[210];
int main()
{
	cin>>t;
	while(t--)
	{
		cin>>m;
		memset(f,0,sizeof(f));
		memset(occ,0,sizeof(occ));
		for(int i=1;i<=m;i++)
		{
			cin>>a>>b;
			int maxs=0;
			if(a>b)swap(a,b);
			for(int j=(a+1)/2;j<=(b+1)/2;j++)
			{
				occ[j]++;
				maxs=max(maxs,occ[j]);
			}
			f[i]=max(f[i-1],maxs*10);
		}
		cout<<f[m]<<endl;
	}
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator