Vasya and Basketball
来源:互联网 发布:spss卡方检验数据输入 编辑:程序博客网 时间:2024/06/06 19:03
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
int num1[211111];
int num2[211111];
int num[411111];
long long res1, res2;
long long ans1, ans2;
int n, m;
int main()
{
while(scanf("%d",&n) != EOF && n)
{
int r = 0;
for(int i = 0; i < n; i++)
scanf("%d",&num1[i]), num[i] = num1[i];
scanf("%d",&m);
for(int j = 0; j < m; j++)
scanf("%d",&num2[j]), num[j+n] = num2[j];
int tot1 = n*3,tot2 = m*3;
int ans = tot1 - tot2;
int l1 = 0, l2 = 0;
sort(num1, num1 + n);
sort(num2, num2 + m);
sort(num, num + n + m);
int ans1 = tot1, ans2 = tot2;
for( int i = 0; i < n+m; i++)
{
while(l1 < n && num1[l1] <= num[i]) l1++;
while(l2 < m && num2[l2] <= num[i]) l2++;
tot1 = (n-l1)*3 + l1*2;
tot2 = (m-l2)*3 + l2*2;
if(tot1 - tot2 > ans)
{
ans = tot1 - tot2;
ans1 = tot1;
ans2 = tot2;
}
}
printf("%d:%d\n",ans1, ans2);
}
}
#include <algorithm>
#include <stdio.h>
using namespace std;
int num1[211111];
int num2[211111];
int num[411111];
long long res1, res2;
long long ans1, ans2;
int n, m;
int main()
{
while(scanf("%d",&n) != EOF && n)
{
int r = 0;
for(int i = 0; i < n; i++)
scanf("%d",&num1[i]), num[i] = num1[i];
scanf("%d",&m);
for(int j = 0; j < m; j++)
scanf("%d",&num2[j]), num[j+n] = num2[j];
int tot1 = n*3,tot2 = m*3;
int ans = tot1 - tot2;
int l1 = 0, l2 = 0;
sort(num1, num1 + n);
sort(num2, num2 + m);
sort(num, num + n + m);
int ans1 = tot1, ans2 = tot2;
for( int i = 0; i < n+m; i++)
{
while(l1 < n && num1[l1] <= num[i]) l1++;
while(l2 < m && num2[l2] <= num[i]) l2++;
tot1 = (n-l1)*3 + l1*2;
tot2 = (m-l2)*3 + l2*2;
if(tot1 - tot2 > ans)
{
ans = tot1 - tot2;
ans1 = tot1;
ans2 = tot2;
}
}
printf("%d:%d\n",ans1, ans2);
}
}
0 0
- C. Vasya and Basketball
- codeforces Vasya and Basketball
- Vasya and Basketball
- Vasya and Basketball 题解报告
- codeforces 493C Vasya and Basketball
- CF_493 C- Vasya and Basketball(二分)
- CodeForces 493C Vasya and Basketball
- codeforces 493C Vasya and Basketball(枚举)
- Codeforces 493C Vasya and Basketball(暴力)
- CodeForces 493C Vasya and Basketball
- CodeForces493C C. Vasya and Basketball 二分
- codeforces493C Vasya and Basketball (二分查询)
- codeforces493 A. Vasya and Football B. Vasya and Wrestling C. Vasya and Basketball
- codeforces 493C Vasya and Basketball(二分)
- Codeforces #281 (Div. 2)C Vasya and Basketball(二分)
- Codeforces Round 281 div2 C Vasya and Basketball
- codeforces #493C# Vasya and Basketball(二分upper_bound+贪心)
- CF 281div2 c题Vasya and Basketball
- glib入门
- 这样的活着
- 学习要点
- Hadoop应用开发--基于MapReduce推荐系统的实现
- HEX文件格式解析
- Vasya and Basketball
- dispatch_barrier_async的使用
- RDIFramework.NET ━ 9.6 模块(菜单)管理 ━ Web部分
- ubuntu telnet服务开启
- Linux下gcc编译器生成和使用静态库和动态库学习笔记
- html5 canvas 详细使用教程
- SQL compute by 的使用
- Calendar的getActualMaximum
- POJ 1837 Balance