题意: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. REST服务安全-双向认证

    1. 创建服务器密钥,其密钥库为 d:/mykeys/server.ks,注意keypass和storepass保持一致,它们分别代表 密钥密码和密钥库密码,注意 CN=localhost 中,loc ...

  2. jstack生成的Thread Dump日志结构解析

    1 第一部分:Full thread dump identifier 2 第二部分:Java EE middleware, third party & custom application T ...

  3. linux常用命令:ifconfig 命令

    许多windows非常熟悉ipconfig命令行工具,它被用来获取网络接口配置信息并对此进行修改.Linux系统拥有一个类似的工具,也就是ifconfig(interfaces config).通常需 ...

  4. js 操作数字类型

    1.内置函数 Number().parseInt().parseFloat() var num = "88.88abc888"; Number(num);              ...

  5. 怎样把QQ群降级(1000人降到200或500人,500人降到200)

    怎样把QQ群降级(1000人降到200或500人,500人降到200)QQ群只有升级的选项,没有降级选项,一旦升级为1000人,就无法直接降级为200人或500人,建群时选择了500人也无法降到200 ...

  6. vm #set、日期截取、#foreach&#if

    <div class="form_row"> <label>状态:</label> #if ($!cp.runState =='t') #set ...

  7. Finalize和Dispose的区别

    https://www.cnblogs.com/Jessy/articles/2552839.html

  8. 贪婪算法(Greedy Algorithm)

    Greedy Algorithm <数据结构与算法--C语言描述> 图论涉及的三个贪婪算法 Dijkstra 算法 Prim 算法 Kruskal 算法 Greedy 经典问题:coin ...

  9. C++ 项目中直接使用JsonCpp源码文件

    之前在网上看到使用JsonCpp都是以库的形式使用(编译源码为静态库或者动态库),这样引用很方便,但有时候报错调试看不到错误的地方,所以就想直接把源文件添加到项目中,方便调试 这是用到源码文件: 创建 ...

  10. JAVA I/O(六)多路复用IO

    在前边介绍Socket和ServerSocket连接交互的过程中,读写都是阻塞的.套接字写数据时,数据先写入操作系统的缓存中,形成TCP或UDP的负载,作为套接字传输到目标端,当缓存大小不足时,线程会 ...