Code:

#include<cstdio>
#include<map>
#include<iostream>
#include<cmath>
#include<bitset>
using namespace std;
const int maxn = 100000 + 3;
map<double, int> idx;
int val[maxn], l[maxn], r[maxn], cnt;
bitset<130> Gleft[40000], Gright[40000];
inline double getinter(int a, int b){ return (double) min(a, b) + abs(a - b) / 2; }
int main(){
int n, m;
cin >> n >> m;
for(int i = 1;i <= n; ++i) scanf("%d",&l[i]);
for(int i = 1;i <= m; ++i) scanf("%d",&r[i]);
for(int i = 1;i <= n; ++i)
for(int j = 1;j <= m; ++j){
double inter = getinter(l[i], r[j]);
if(!idx[inter]) idx[inter] = ++cnt;
Gleft[idx[inter]].set(i, 1);
Gright[idx[inter]].set(j, 1);
}
int ans = 0;
for(int i = 1;i <= cnt; ++i)
for(int j = 1;j <= cnt; ++j)
{
bitset<130>A, B;
A = Gleft[i] | Gleft[j];
B = Gright[i] | Gright[j];
int cur = A.count() + B.count();
ans = max(ans, cur);
}
cout << ans;
return 0;
}

  

CF993C Careful Maneuvering bitset_枚举的更多相关文章

  1. codeforces 993c//Careful Maneuvering// Codeforces Round #488 by NEAR (Div. 1)

    题意:x轴-100和+100的有敌人飞船,纵坐标由输入数据给出,我方有2飞船在x轴0,y坐标待定.0时刻时敌人同时向我方2飞船发出光线,光线会穿透飞船打到敌人自己,问2飞船放在哪敌人损失最大? 假如- ...

  2. Codeforces 993C. Careful Maneuvering(详细注解)

    解题思路 -100和+100是没有用的,只要知道左边的飞船轴和右边的飞船轴离y轴一样近即可.为简单起见,我们将左边的轴设为-1,右边的设为1. 某个点能摧毁的飞船一定是因为有两个飞船关于这个点对称.即 ...

  3. [Codeforces Round#488]Div.2

    总结 这是我无聊透顶肝到三点半的一场 cf ,结果还真够无聊的 这套题涵盖了英语题,语文题,模拟题.注重考查了选手的英语素养能力,语文阅读能力和精湛的模拟和枚举能力.是不可多得的一套好题. 没什么单独 ...

  4. 【Codeforces】Round #488 (Div. 2) 总结

    [Codeforces]Round #488 (Div. 2) 总结 比较僵硬的一场,还是手速不够,但是作为正式成为竞赛生的第一场比赛还是比较圆满的,起码没有FST,A掉ABCD,总排82,怒涨rat ...

  5. 【CF Manthan, Codefest 17 A】Tom Riddle's Diary

    [链接]h在这里写链接 [题意] 在这里写题意 [题解] /* Be careful. 二重循环枚举 */ [错的次数] 0 [反思] 在这了写反思 [代码] #include <bits/st ...

  6. [POI2006]ORK-Ploughing(贪心,枚举)

    [POI2006]ORK-Ploughing 题目描述 Byteasar, the farmer, wants to plough his rectangular field. He can begi ...

  7. Swift enum(枚举)使用范例

    //: Playground - noun: a place where people can play import UIKit var str = "Hello, playground& ...

  8. 编写高质量代码:改善Java程序的151个建议(第6章:枚举和注解___建议88~92)

    建议88:用枚举实现工厂方法模式更简洁 工厂方法模式(Factory Method Pattern)是" 创建对象的接口,让子类决定实例化哪一个类,并使一个类的实例化延迟到其它子类" ...

  9. Objective-C枚举的几种定义方式与使用

    假设我们需要表示网络连接状态,可以用下列枚举表示: enum CSConnectionState { CSConnectionStateDisconnected, CSConnectionStateC ...

随机推荐

  1. VS Code中html 如何查找标签(5)

    1  添加几个标签 <body> <span>第一个span标签</span> <p>这是第一个p标签</p> <span>第二 ...

  2. N1-1 - 树 - Minimum Depth of Binary Tree

    题目描述: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the ...

  3. seliux(类似防火墙,限制root用户)

    注:如果在开发是不设置关闭,可能会出现很多不在预期内的效果 路径:/etc/selinux/config *修改(修改时拷贝对照) (拷贝):cp /etc/selinux/config /etc/s ...

  4. php文件上传相关知识点回顾

    近来正在回顾PHP的文件上传.在此做个记录. <?php date_default_timezone_set('PRC'); if(isset($_POST['submit'])) { echo ...

  5. Adnroid_sdk安装代理

  6. CF449 C. Jzzhu and Apples

    /* http://codeforces.com/problemset/problem/449/C cf 449 C. Jzzhu and Apples 数论+素数+贪心 */ #include &l ...

  7. CF899A Splitting in Teams

    CF899A Splitting in Teams 题意翻译 n个数,只有1,2,把它们任意分组,和为3的组最多多少 题目描述 There were nn groups of students whi ...

  8. Eclipse-去除空白行

    CTRL+F Find: ^\s*\n            注意前后不要有空白 Replace With:          为空,不填 勾选:Regular expressions 正则表达式 替 ...

  9. 页面与后台传递中文乱码问题(java乱码)

    1.前台中文传递到后台乱码. 前台不须要处理, 系统一般都会默认把中文转化为ISO-8859-1类型. 仅仅需在后台接受数据是处理 Str为前台传过来的中文字符串: String inputer = ...

  10. TeamTalk Android代码分析(业务流程篇)

    TeamTalk Android代码分析(业务流程篇) 1.1 总体结构 1.总体结构有点类似MVC的感觉,模块结构从上向下大体是: UI层:Activity和Fragment构成,期间包括常用的一些 ...