hdu 4022 Bombing(STL)

广工计组f4b 8位12指令微程序CPU设计实验报告(内含可通过代码以及波形图) 实验目的:模型机是计算机的缩细模型,通过它可以理解计算机整机的结构和功能,理解CPU,存储器,中断控制器,接口的结构及实现逻辑和各部件之前的接口关系。本实验是设计一个8位模型计算机。:一条机器指令可以分解成一个微操作序列,这些微操作是计算机最基本的,不可再细分的操作。:在微程序控制的计算机中。将控制部件向执行部件发出的各种控制命令成为微命令,它是构成控制序列的最小单位。微命令和微操作是一一对应的。微命令是微操作的控制信号,微操作微命令的执行过程。2.:微指令是若干微命令的集合。 阅读详情

Bombing

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others)
Total Submission(s): 4834    Accepted Submission(s): 1813


Problem Description
It’s a cruel war which killed millions of people and ruined series of cities. In order to stop it, let’s bomb the opponent’s base.
It seems not to be a hard work in circumstances of street battles, however, you’ll be encountered a much more difficult instance: recounting exploits of the military. In the bombing action, the commander will dispatch a group of bombers with weapons having the huge destructive power to destroy all the targets in a line. Thanks to the outstanding work of our spy, the positions of all opponents’ bases had been detected and marked on the map, consequently, the bombing plan will be sent to you.
Specifically, the map is expressed as a 2D-plane with some positions of enemy’s bases marked on. The bombers are dispatched orderly and each of them will bomb a vertical or horizontal line on the map. Then your commanded wants you to report that how many bases will be destroyed by each bomber. Notice that a ruined base will not be taken into account when calculating the exploits of later bombers.
 

Input
Multiple test cases and each test cases starts with two non-negative integer N (N<=100,000) and M (M<=100,000) denoting the number of target bases and the number of scheduled bombers respectively. In the following N line, there is a pair of integers x and y separated by single space indicating the coordinate of position of each opponent’s base. The following M lines describe the bombers, each of them contains two integers c and d where c is 0 or 1 and d is an integer with absolute value no more than 10 9, if c = 0, then this bomber will bomb the line x = d, otherwise y = d. The input will end when N = M = 0 and the number of test cases is no more than 50.
 

Output
For each test case, output M lines, the ith line contains a single integer denoting the number of bases that were destroyed by the corresponding bomber in the input. Output a blank line after each test case.
 

Sample Input

 
3 2 1 2 1 3 2 3 0 1 1 3 0 0
 

Sample Output

 
2 1
 

Source
 

Recommend
lcy


题意:

在二维坐标轴上有N个坐标,有M次操作,每次给出d,x当d=0时,删除x轴上坐标为x的所有坐标并输出个数,d=1时,删除y轴上坐标为x的所有坐标输出个数。

思路:

因为只有1e5个坐标,也就是x和y轴上出现的坐标最多也只有1e5,而数可以达到1e9,需要离散化。

所以用map+multiset来解决,设置两个一个存x轴上的每个坐标对应的y坐标,同理一个存y轴的。

每次更新的时候都需要将两个map来更新。

代码:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

map <int,multiset<int> > mpx;
map <int,multiset<int> > mpy;
multiset<int> :: iterator it;
int main()
{
    int n,m,x,y;
    while(~scanf("%d%d",&n,&m)&&n&&m)
    {
        mpx.clear();
        mpy.clear();
        for(int i=1;i<=n;i++)
        {
            scanf("%d%d",&x,&y);
            mpx[x].insert(y);
            mpy[y].insert(x);
        }
        for(int i=1;i<=m;i++)
        {
            scanf("%d%d",&x,&y);
            if(x==0)
            {
                printf("%d\n",mpx[y].size());
                for(it=mpx[y].begin();it!=mpx[y].end();it++)
                {
                    mpy[*it].erase(mpy[*it].find(y));
                }
                mpx[y].clear();
            }
            else
            {
                printf("%d\n",mpy[y].size());
                for(it=mpy[y].begin();it!=mpy[y].end();it++)
                {
                    mpx[*it].erase(mpx[*it].find(y));
                }
                mpy[y].clear();
            }
        }
        printf("\n");
    }
    return 0;
}


096、PCIE环回模式(Loopback):调试时自己和自己对话的利器 摘要: PCIE环回模式是调试利器,通过让芯片内部数据自环来定位问题层级。文章详解三种环回模式:物理层环回验证基础收发,数据链路层环回测试DLLP机制,事务层环回验证端到端协议。分享了实战中的典型问题(时钟异常、状态机卡死、计数器失真)和"从下往上"的调试流程,强调要区分调试与生产功能,建议早期验证环回模式。通过具体代码示例和调试案例,说明合理使用环回模式能显著提升排查效率,是PCIE调试必备技能。(149字) 阅读详情

相关推荐

Cursor赋能Qt C++:从环境配置到项目构建的AI开发新范式

本文详细介绍了如何利用Cursor工具链提升Qt C++开发效率,从智能环境配置到CMake项目构建的全流程实践。通过AI辅助编程、Qt生态优化及高级调试技巧,开发者可快速完成从传统开发到AI驱动的新范式转换,显著缩短项目搭建时间并提升代码质量。

weixin_30329623的博客 546

hdu 4022(map一对多)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4022 STL应用,一开始用multimap写的,然后实现不了,于是就看了别人用map自定义了一个一对多。。。orz。。。 剩下的就简单了。。分别用两个这样的map容器装下 x为键,y为值,和y为键,x为值的两个容器。 然后当C==0就输出当键位d的容器大小,并且去掉另一个容器中出现的点。 同理C...

weixin_33721427的博客 201

U-Boot 适配新型号 SPI Nor Flash 实战解析

本文详细解析了U-Boot适配新型号SPI Nor Flash的全过程,从JEDEC ID识别错误入手,深入源码分析Flash信息数据库,结合实际手册参数添加新设备支持。重点介绍了设备树同步和验证调试的关键步骤,并总结了常见问题与解决方案,为嵌入式开发者提供实用参考。

weixin_29170327的博客 201

hdu4022

题目大意:给你n个点(二位),坐标范围(<10^9)然后m次询问0 s 表示询问x = s这条线上有多少个点并删除1 s 表示询问y = s这条线上有多少个点并删除import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStre

老李2009 834

告别连接难题:Windows 11下Multisim主数据库稳定运行终极配置指南

本文详细解析了Windows 11下Multisim 14.0主数据库连接失败的三大根源,并提供了四步终极解决方案,包括系统环境优化、软件权限配置、注册表修复和网络验证绕过技巧。通过实测数据对比,本方案显著提升了启动速度和稳定性,解决了电子仿真中的常见连接问题。

weixin_33738555的博客 432

CTF 命令执行绕过总结

tac:从最后一行开始显示,可以看出 tac 是 cat 的反向显示。或:rce-xor-or.php & rce-xor-or.py。# ls -t >shell 将输出输入到shell文件中。异或:rce-xor.php & rce-xor.py。%09(url传递)(cat%09flag.php)sh /flag 2>%261 //报错出文件内容。2、1使用空变量$*和$@,$x,${x}绕过。7、异或无符号(过滤0-9a-zA-Z)more:一页一页的显示档案内容。

jnszstmei的博客 1959

HDU4022 bombing [map与multiset]

1.使用map<int,multiset<int>> x_map,y_map储存基地的位置。x_map表示x轴上(x=1,2,3...)存在的基地,y_map同理。3.使用find查找对应的x轴或y轴上是否存在军事基地,如果找到(没有返回最后一个迭代器),使count(摧毁军事基地的数量)等于it内层的大小,删去该map上对应的军事基地,并删去另一个map上对应的军事基地。2.x_map的结构 x_map={ 1->{1,2,3},3->{3}...}。

2403_87149971的博客 571

2026年数字IC设计禾赛科技笔试带答案解析

本文介绍了一份数字IC设计工程师笔试的试卷结构和部分题目解析。试卷包含15道单选题(30分)、10道填空题(20分)和5道简答/编程题(50分),总分100分,考试时长120分钟。单选题涉及同步时序电路、Verilog语法、跨时钟域设计、FPGA优化、存储器层次、功耗优化等知识点;填空题考查环形振荡器、工艺参数、时序约束、LUT结构等基础概念。试题重点考察应聘者对数字电路设计核心概念的理解和实际工程应用能力,特别是针对激光雷达芯片设计中的关键技术点进行考核。

Open 123

Bombing HDU, 4022(QQ糖的消法)

题目大意: 给你n个敌人的坐标,再给你m个炸弹和爆炸方向,每个炸弹可以炸横排或竖排的敌人,问你每个炸弹能炸死多少个人。 解题思路: 用map里面嵌套multiset , 1000多ms,还是有点长的,老师说要用list ,不知是否要快点。

Menglei Min 1509

55、磁吸附爬壁机器人运动仿真与位置控制

本文针对大型船舶喷涂作业中人工操作存在的高风险与低效率问题,提出一种基于麦克纳姆轮的磁吸附爬壁机器人运动控制方案。通过建立Adams虚拟样机与MATLAB/Simulink控制系统的联合仿真模型,设计了速度和位置双闭环控制系统,采用模糊PI控制器优化速度响应,并引入位置反馈补偿重力引起的垂直偏移。研究结果表明,模糊PI控制器在响应速度、超调抑制和位置稳定性方面优于传统PI控制器,且位置反馈能有效校正横向移动中的下坠现象,尤其在跨越焊缝等复杂工况下仍可保持稳定运行,显著提升了爬壁机器人的运动精度与作业可靠性。

linux6sysadmin的博客 168

【STK】手把手教你利用STK进行关联分析仿真01-STK/CAT模块介绍

今天主要介绍接近分析工具CAT。

weixin_44184852的博客 1106

HDU 4022 Bombing

Description It’s a cruel war which killed millions of people and ruined series of cities. In order to stop it, let’s bomb the opponent’s base.  It seems not to be a hard work in circumstances of s

杭锦泉的博客 406

python中视觉检测怎么将多个面拍照的图片合成一个3d图像,用什么技术或者什么模型?

🏆本文收录于 《全栈Bug调优(实战版)》 专栏,该专栏专注于分享我在真实项目开发中遇到的各类疑难Bug及其深层成因,并系统提供高效、可复现的解决思路和实操方案。无论你是刚入行的新手开发者,还是拥有多年项目经验的资深工程师,本专栏都将为你提供一条系统化、高质量的问题排查与优化路径,助力你加速成长,攻克技术壁垒,迈向技术价值最大化与职业发展的更高峰🚀!

**My Coding Family** 709

HDU 4022 Bombing STL/二分

用stl的set和map #include #include #include #include #include #include #include #include using namespace std; typedef map > def; void pop(def &a,def &b,int k) { printf("%d\n",a[k].size()); for(multise

1292765944的专栏 1053

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

HDU 4022 Bombing STL 模拟题

手动模拟。。 #include #include #include #include #include #include #include #include using namespace std; #define N 10100 #define inf 1000000010 mapx,y; struct X{ int x,y; bool operator<(const X&a)const{

九野的博客 1738

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

【STL】hdu 4022 Bombing

multiset 容器

Gzbgreat的博客 374

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

HDU 4022 Bombing (STL)

题意: 给出包含N个点的点集和M次操作 对于每个操作 w z w=1时 删除 坐标y=z的点,并输出个数 w=0时 删除 坐标x=z的点,并输出个数 思路: AVL树问题,STL实现即可 代码: #include using namespace std; const int INF=0x3f3f3f3f; typedef struct Node{ int k1;

DT2131 403

HDU 4022 Bombing (STL应用)

Bombing Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 1377    Accepted Submission(s): 533 Problem Description It’s a cruel war which killed...

weixin_34126557的博客 127

2011年上海网络赛·STL·HDU 4022 Bombing

题目大意:给定一张图中的基地坐标,再给定m个炸弹:'0'  x: 炸掉坐标为x的基地'1' y :炸掉坐标为y的基地解题思路:map存储基地,开两个分别存对应x和y的基地;查询直接输出size,不要忘记删掉炸过的基地AC代码:#include &lt;map&gt; #include &lt;set&gt; #include &lt;stack&gt; #include &lt;cmath&gt;...

吾之奉先的博客 185

HDU 4022Bombing 2011网络赛(二分 或 STL)

Bombing Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) Total Submission(s): 1884    Accepted Submission(s): 703 Problem Description It’s a cruel war wh

布生气 1869

hdu4022_Bombing(STL_map)

Bombing Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) Total Submission(s): 4178    Accepted Submission(s): 1572 Problem Description It’s a cruel war which

no2015214099的博客 280

hdu4022 Bombing stl(map+set)

The 36th ACM/ICPC Asia Regional Shanghai Site —— Online Contest 题意:轰炸机轰炸基地,一颗炸弹炸一排或一行,按顺序输出每个轰炸机轰炸基地的个数。 map+set 除了代码短,时空复杂度都高,囧~要用其他方法做

749

HDU_4022_Bombing

HDU_5022_Bombing It’s a cruel war which killed millions of people and ruined series of cities. In order to stop it, let’s bomb the opponent’s base. It seems not to be a hard work in circumstances of street

Sothan 506

Bombing HDU - 4022

Bombing HDU - 4022 题意:给出n个目标,m个炸弹,每个炸弹可以炸一行或者一列,问每一个炸弹摧毁了多少目标。 可以用STL做,也可以二分做。 这是kuangbin的代码~ 用STL很简洁,但是慢 1 /* 2 HDU 4022 3 G++ 1296ms 4 5 6 */ 7 8 9 #include<st...

weixin_30292843的博客 167

hdu 4022 Bombing

4022Bombing 题目大意:给你n个点(二位),坐标范围(<10^9)然后m次询问 0 s 表示询问x = s这条线上有多少个点 1 s 表示询问y = s这条线上有多少个点 一个点被算过以后和面的询问就不能再计算了 分析:最容易想到的就是每次询问后把计算过的点标记一下下次询问就不需要再计算了,然后对于维护一下每个横纵线上有多少点。但坐标范围很大怎么办? STL!!!真的...

weixin_33724570的博客 90
上一篇: hdu 4020 Ads Proposal(优先队列)
下一篇: hdu 4028 The time of a day (DP+离散化)
Timeclimber
博客等级 码龄9年 25粉丝 198原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值