Bombing(HDU-4022)

从零构建:如何用MATLAB工具箱打造你的第一个多体动力学仿真模型 本文详细介绍了如何使用MATLAB的Simscape Multibody工具箱从零开始构建多体动力学仿真模型,特别适合初学者学习倒立摆系统的建模与仿真。文章涵盖环境准备、坐标系设置、物理模型构建、参数化建模及性能优化等关键步骤,帮助工程师快速掌握这一强大的仿真工具。 阅读详情
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 109, 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
 
题目大意:由于xxx原因,我们要炸掉敌方基地,输入n(敌方基地个数)和m(我方轰炸机的个数),然后输入n个基地的坐标(x,y),输入c,d,如果c=0,将轰炸x=d的所有坐标,c=1,将轰炸y=d的所有坐标,输出每个轰炸机轰炸的个数;

代码如下:
#include<bits/stdc++.h>
using namespace std;
#define ma map<int,multiset<int> >
#define se multiset<int>
ma a,b;
void my_solve(se &r1,ma &r2,int d)
{
    int cnt=0;
    for(set<int>::iterator it=r1.begin();it!=r1.end();it++)
    {
        r2[*it].erase(d);
        cnt++;
    }
    r1.clear();
    cout<<cnt<<endl;
}
int main()
{
    int n,m;
    while(~scanf("%d%d",&n,&m)&&(n!=0||m!=0))
    {
        int x,y;
        for(int i=1;i<=n;i++)
        {
            scanf("%d%d",&x,&y);
            a[x].insert(y);
            b[y].insert(x);
        }
        for(int i=1;i<=m;i++)
        {
            int c,d,cnt=0;
            scanf("%d%d",&c,&d);
            if(c==0)
                my_solve(a[d],b,d);
            else
                my_solve(b[d],a,d);
        }
        printf("\n");
        a.clear();
        b.clear();
    }
    return 0;
}


QT实现ftp服务器(附完整源码) 阅读详情

相关推荐

VS2022离线安装总闪退?可能是这个--noWeb参数没加对(完整参数指南)

本文深入解析了VS2022离线安装过程中常见的闪退问题,指出核心原因往往在于命令行参数使用不当,特别是`--noWeb`参数。文章提供了完整的参数使用指南和实战解决方案,包括证书处理、安装器文件修复及自动化脚本,帮助用户彻底解决离线部署中的验证失败与闪退难题。

weixin_28842269的博客 762

Bombing HDU, 4022(QQ糖的消法)

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

Menglei Min 1510

TEC 高精度控温算法:实现精准升降温与恒温控制

本文深入解析了TEC高精度控温算法的核心原理与工程实践。针对TEC非线性、时变的特性,算法通过智能状态机实现精准升降温与恒温控制,并详细阐述了参数整定、硬件协同及调试优化的系统性方法,为半导体激光器、PCR仪等高精度温控应用提供了一套完整的解决方案。

weixin_29212867的博客 1015

HDU - 4022 Bombing (multiset)

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,

深海沧澜的博客 292

Playwright Java环境配置避坑指南:浏览器路径、类加载与离线部署

Playwright作为现代端到端测试框架,其Java SDK突破了传统Selenium的Driver管理模式,将Chromium/Firefox/WebKit内核视为可编程运行时资源。其核心原理在于SDK与浏览器二进制分离——Maven仅管理Java字节码,而浏览器需独立下载、校验与沙箱加载。这一设计带来显著技术价值:跨平台一致性、进程隔离安全性及多浏览器并行能力;典型应用场景涵盖Spring Boot集成测试、金融级离线CI/CD、Kubernetes容器化部署及Air-Gapped封闭环境。然而,因J

weixin_32956805的博客 680

18650电池组流体直冷热管理仿真:COMSOL多物理场耦合建模路线与实战策略

在动力电池与储能系统的热管理设计中,多物理场耦合仿真已成为平衡性能与成本的关键工具。液冷方案的换热极限促使行业转向制冷剂直冷技术,而两相流与电池产热的强耦合特性,使得基于COMSOL的数值建模成为评估系统温升与流动分配的重要手段。工程实践中,电化学-热-流场全耦合模型与集总电池-流场简化模型各有适用场景,前者揭示电池内部微观机理,后者则以高计算效率支撑包级方案迭代。通过合理简化几何、标定内阻与熵热系数、设置等效换热边界,仿真能够准确预测直冷系统在快充或大倍率放电下的温度均匀性与压降特性,从而指导流道优化与制

weixin_33585822的博客 316

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

保姆级教程:Java调用海康SDK实现录像回放与倍速播放(附完整代码)

本文详细介绍了如何使用Java调用海康SDK实现录像回放与倍速播放功能,包括开发环境配置、设备连接、流媒体处理、倍速播放实现及性能优化等关键步骤。通过完整的代码示例和实战经验,帮助开发者快速构建智能录像回放系统,提升开发效率。

weixin_29285605的博客 360

HDU 4022 Bombing

HDU 4022 Bombing

爪哇D来客 611

Mac和VScode配置fortran

macOS系统 vscode fortran gfortran 终端

weixin_43047707的博客 2412

Haclon案例-找出图中面积最大的圆

自带的函数,求得圆的面积和圆心点坐标,然后,用本章所学习的选择算子和循环算子找出面积最大的圆。的图片,试着给它加上不同种类的噪声,然后找出其中面积最大的圆,并将圆的面积标注在其圆心位置。可知,除了六个圆形之外,还有一些微小的噪声点,采用了开运算和特征选择的方法去除噪声。1. 该图片为一灰度图,对其进行二值化,二值化后如图。4. 在面积最大圆的圆心坐标位置写上该圆的面积。

qq_20660115的博客 906

hdu 4022 Bombing

1002 Bombing  The 36th ACM/ICPC Asia Regional Shanghai Site —— Online Contest 本题的思路就是将点映射一下,一次加入map,坐标值变成映射值,这样在利用静态链表进行处理,因为有可能横着炸或者竖着炸,

凌风 3799

Vue3 + 高德地图实现车辆电子围栏监控与报警

通过本文的实现,我们完成了一个通用的车辆电子围栏监控功能:支持多种围栏类型。支持进入/离开/双向报警。使用缓存机制避免重复告警。可与Vue3 + 高德地图无缝集成。在实际项目中,可以结合WebSocket 实时定位,实现车辆的实时监控 + 围栏告警系统🚀。

专注于前端开发与实战技巧,记录从零到一的学习与项目经验。分享 Vue3 / JavaScript / TypeScript / Flutter /Uniapp等前端技术,以及 性能优化、工程化、最佳实践。 1036

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 507

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

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

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

HDU -4022 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 battles, however, you’ll be encountered a much more diff

m0_51727949的博客 175

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

hdu4022 bombing map+multiset

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, ho...

mayuqing98的博客 256

HDU 4022 Bombing c++解法

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, ho...

qq_41773202的博客 548

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

【STL】hdu 4022 Bombing

multiset 容器

Gzbgreat的博客 374
上一篇: The kth great number(HDU -4006)
下一篇: sort(HDU-3293)
绿蚁.r
博客等级 码龄10年 4粉丝 37原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值