牛课第二次多校I
链接:https://www.nowcoder.com/acm/contest/140/I
来源:牛客网
题目描述
White Rabbit wants to put in several cars. Each car will start moving at the same time and move from one side of one row or one line to the other. All cars have the same speed. If two cars arrive at the same time and the same position in a grid or meet in a straight line, both cars will be damaged.
White Cloud will destroy the square m times. In each step White Cloud will destroy one grid of the square(It will break all m grids before cars start).Any car will break when it enters a damaged grid.
输入描述:
The first line of input contains two integers n and m(n <= 100000,m <= 100000)
For the next m lines,each line contains two integers x,y(1 <= x,y <= n), denoting the grid which is damaged by White Cloud.
输出描述:
Print a number,denoting the maximum number of cars White Rabbit can put into.
输入例子:
2 0
输出例子:
4
-->
备注:
题解
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e5+;
int a[MAXN],b[MAXN];
int main()
{
int ans=;
int n,m;
scanf("%d%d",&n,&m);
int x,y;
ans=n*-(n%);
for(int i=;i<m;i++)
{
scanf("%d%d",&x,&y);
a[x]=;
b[y]=;
}
int k1=,k2=;
for(int i=;i<n;i++)
{
if(a[i]== ) ans--;
if(b[i]==) ans--;
}
if(n%==&&a[(n+)/]==&&b[(n+)/]==) ans++;
printf("%d\n",ans);
return ;
}
牛课第二次多校I的更多相关文章
- 【C语言探索之旅】 第一部分第四课第二章:变量的世界之变量声明
内容简介 1.课程大纲 2.第一部分第四课第二章:变量的世界之变量声明 3.第一部分第四课第三章预告:变量的世界之显示变量内容 课程大纲 我们的课程分为四大部分,每一个部分结束后都会有练习题,并会公布 ...
- 2018牛客暑期ACM多校训练营第二场(有坑未填)
第二场终于等来学弟 开始(被队友带飞)的开心(被虐)多校之旅 A run A题是一个递推(dp?)+前缀和 因为看数据量比较大 就直接上前缀和了 一个比较简单的递推 没有太多难点 签到题 需要注意 ...
- (原)2018牛课多校第4场--G
传送门 /* 按值从大到小排序,记录下相应出现的次数并去重 枚举:从大到小枚举,如果能够通过删除其他数让当前这个数成为众数,则循环结束,输出此数,如果循环结束也没答案,输出-1 优先级:值优先 举例: ...
- 牛客第二场Dmoney
链接:https://www.nowcoder.com/acm/contest/140/D 来源:牛客网 题目描述 White Cloud has built n stores numbered to ...
- 牛客第二场A-run
链接:https://www.nowcoder.com/acm/contest/140/A 来源:牛客网 White Cloud is exercising in the playground. Wh ...
- cousera 吴恩达 深度学习 第一课 第二周 作业 过拟合的表现
上图是课上的编程作业运行10000次迭代后,输出每一百次迭代 训练准确度和测试准确度的走势图,可以看到在600代左右测试准确度为最大的,74%左右, 然后掉到70%左右,再掉到68%左右,然后升到70 ...
- 牛客暑期ACM多校 第七场
链接:https://www.nowcoder.com/acm/contest/145/C来源:牛客网 C .题目描述 A binary string s of length N = 2n is gi ...
- 2019牛客网暑假多校训练第四场 K —number
链接:https://ac.nowcoder.com/acm/contest/884/K来源:牛客网 题目描述 300iq loves numbers who are multiple of 300. ...
- CODING 敏捷实战系列课第二讲:Scrum 敏捷项目管理核心要素之 3355
Scrum 是敏捷开发流派中最著名和最落地的一支,全球 70% 以上公司的敏捷转型都是以 Scrum 起步.CODING 特邀敏捷顾问.CST & CTC 认证敏捷教练申健老师将在本课程< ...
随机推荐
- H5移动端原生长按事件
// 函数名longpress// 参数为: 需长按元素的id.长按之后处理函数func function longPress(id, func,timeout=500) { var timeOutE ...
- webpack.config.js====CSS相关:插件optimize-css-assets-webpack-plugin
1. 安装:主要是用来压缩css文件 cnpm install --save-dev optimize-css-assets-webpack-plugin cssnano 2. webpack.con ...
- 华为云kafka POC 踩坑记录
2019/03/08 18:29 最近在进行华为云相关POC验证,个人主要负责华为云DMS kafka相关.大致数据流程是,从DIS取出数据,进行解析处理,然后放入kafka,再从kafka中取出数据 ...
- angular 学习笔记(3) ng-repeat遍历json并且给样式
视图: <div ng-app="myapp" ng-controller="myctrl"> <ul> <li ng-repea ...
- 常用的Homebrew命令
一些常用的Homebrew命令: 更新:brew update 安装包信息检索:brew info 安装包搜索:brew search foo 安装包列表:brew list 过时信息:brew ou ...
- 【Android车载系统 News | Tech 5】车载设计开发
1. 基于Android的车载移动终端系统的研究与开发 http://wenku.baidu.com/link?url=hIKlQ2myEmR8N0CA28a_SLzLA2Q9R5Xpk20OJ53h ...
- COGS 11. 运输问题1
★★☆ 输入文件:maxflowa.in 输出文件:maxflowa.out 简单对比时间限制:1 s 内存限制:128 MB [问题描述] 一个工厂每天生产若干商品,需运输到 ...
- SQL Server 删除当前数据库中所有数据库 ,无视约束
Sql Server中清空所有数据表中的记录 清空所有数据表中的记录: exec sp_msforeachtable @Command1 ='truncate table ?' 删除所有数据表: e ...
- python_61_装饰器4
import time def timer(func):#timer(test1) func=test1 def deco(): start_time=time.time() func()#run t ...
- Deep Learning 优化方法总结
Stochastic Gradient Descent (SGD) SGD的参数 在使用随机梯度下降(SGD)的学习方法时,一般来说有以下几个可供调节的参数: Learning Rate 学习率 We ...