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

假如-100有飞船a,+100有飞船b,那么在两者y坐标和/2的位置放飞船,就炸掉2个。数据是60*60最多3600,将所有的和涉及的左飞船,右飞船或起来(位运算|)。然后二重循环和,或起来看数量。

//#pragma comment(linker,"/STACK:1024000000,1024000000")
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include <stack>
#include <bitset>
using namespace std;
const int SZ=,INF=0x7FFFFFFF;
bitset<> bt1[SZ],bt2[SZ]; int main()
{
std::ios::sync_with_stdio();
//freopen("d:\\1.txt","r",stdin);
//for(;scanf("%d",&n)!=EOF;)
{
int n,m;
cin>>n>>m;
vector<int> v1(n),v2(m);
for(int i=;i<n;++i)cin>>v1[i];
for(int i=;i<m;++i)cin>>v2[i];
set<int> st;
for(int i=;i<n;++i)
{
for(int j=;j<m;++j)
{
int val=v1[i]+v2[j]+;
bt1[val][i]=;
bt2[val][j]=;
st.insert(val);
}
}
int res=;
for(auto it=st.begin();it!=st.end();++it)
{
int cur=*it;
for(auto j=st.begin();j!=st.end();++j)
{
//if(j==it)continue;
int tmp=(bt1[cur]|bt1[*j]).count()+(bt2[cur]|bt2[*j]).count();
res=max(res,tmp);
}
}
cout<<res<<endl;
}
return ;
}

codeforces 993c//Careful Maneuvering// Codeforces Round #488 by NEAR (Div. 1)的更多相关文章

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

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

  2. Codeforces Round #488 by NEAR (Div. 2)

    A 开个桶记录是否出现即可. 时间复杂度 \(O\left(n+m\right)\). B 按能力值从小到大依次加入,然后维护前 \(k\) 大的金币数即可. 时间复杂度 \(O\left(n\log ...

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

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

  4. [Codeforces Round#488]Div.2

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

  5. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  6. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

  7. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

  8. Educational Codeforces Round 35 (Rated for Div. 2)

    Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...

  9. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...

随机推荐

  1. web.xml+spring mvc基本配置

    web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi=" ...

  2. linux make命令安装详解

    对于GNU Make或许很多Windows开发的程序员并不是很了解,因为Windows中的很多集成开发环境(IDE)都帮我们做了这件事.但是作为一个专业从事 Linux嵌入式开发的程序员就必须要了解G ...

  3. DeepMind已将AlphaGo引入多领域 Al泡沫严重

    DeepMind已将AlphaGo引入多领域 Al泡沫严重 在稳操胜券的前提下,谷歌旗下的AlphaGo还是向柯洁下了战书.4月10日,由中国围棋协会.浙江省体育局.谷歌三方联合宣布,将于5月23日至 ...

  4. [转载] My97DatePicker日历实现开始日期小于结束日期验证

    <tr align='center'> <td align="right">开始日期: </td> <td align="lef ...

  5. bzoj1647 / P1985 [USACO07OPEN]翻转棋

    P1985 [USACO07OPEN]翻转棋 其实我们只要枚举第一行的状态,后面的所有状态都是可以唯一确定的. 用二进制枚举灰常方便 #include<iostream> #include ...

  6. html判断当前页面是否在iframe中/顶级document中

    在使用div+iframe布局的应用中,通常我们希望在session超时或者未登录访问时跳转到登录页面,默认情况下iframe中的页面无法直接覆盖父页面,因此需要在登录页面加载的时候判断一下当前是否为 ...

  7. ssh服务的最佳实践

    工作中ssh的最佳实践: 不要使用默认端口 禁止使用protocol version 1 (默认centos6/7已经禁止使用第一版了,但是centos5可能还有在用第一版本) 限制可登陆用户 设定空 ...

  8. python常见模块属性与方法

    sys模块的变量 变量 描述 sys.path 模块搜索路径 path[0] 是当前脚本程序的路径名,否则为 '' sys.modules 已加载模块的字典 sys.version 版本信息字符串 s ...

  9. jQuery 中 $( ) 函数的用法总结

    摘要 jQuery对象: 具有jquery框架设置的所有功能的调用者, 就是该框架的对象 $又是什么?: $就是jQuery对象, jQuery对象为window的全局属性, 所以可以直接使用 如何自 ...

  10. GNU C 中零长度的数组【转】

    原文链接:http://www.cnblogs.com/dolphin0520/p/3752492.html 在标准C和C++中,长度为0的数组是被禁止使用的.不过在GNU C中,存在一个非常奇怪的用 ...