CodeForces 701B Cells Not Under Attack
题目链接:http://codeforces.com/problemset/problem/701/B
题目大意:
输入一个数n,m, 生成n*n的矩阵,用户输入m个点的位置,该点会影响该行和该列,每输入一个点则输出剩余未受影响的单元数。
解题思路:
吃饭。。。留坑
2016.09.11 12:05
AC code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m,x,y,ans;
long long sx,sy;
int xx[],yy[];
while(scanf("%d",&n)!=EOF)
{
memset(xx,,sizeof(xx));
memset(yy,,sizeof(yy));
scanf("%d",&m);
sx=sy=(long long)n;
while(m--)
{
scanf("%d %d",&x,&y);
if(!xx[x])
{
sx--;
xx[x]=;
}
if(!yy[y])
{
sy--;
yy[y]=;
}
printf("%I64d\n",sx*sy);
}
}
return ;
}
CodeForces 701B Cells Not Under Attack的更多相关文章
- CF 701B Cells Not Under Attack(想法题)
题目链接: 传送门 Cells Not Under Attack time limit per test:2 second memory limit per test:256 megabyte ...
- codeforces #364b Cells Not Under Attack
比赛的时候 long long sum=n*n,计算不出1e10长度到数,没有搞掉. 哎,以后要注意这个地方.这个题其实不难: 统计能被攻击到的个数,然后用总的个数减掉就可以了.注意有些地方重复计算, ...
- codeforces 701B B. Cells Not Under Attack(水题)
题目链接: B. Cells Not Under Attack 题意: n*n的棋盘,现在放m个棋子,放一个棋子这一行和这一列就不会under attack了,每次放棋子回答有多少点还可能under ...
- Codeforces Round #364 (Div. 2) B. Cells Not Under Attack
B. Cells Not Under Attack time limit per test 2 seconds memory limit per test 256 megabytes input st ...
- Codeforces Round #364 (Div. 2) Cells Not Under Attack
Cells Not Under Attack 题意: 给出n*n的地图,有给你m个坐标,是棋子,一个棋子可以把一行一列都攻击到,在根据下面的图,就可以看出让你求阴影(即没有被攻击)的方块个数 题解: ...
- codeforces 701 B. Cells Not Under Attack
B. Cells Not Under Attack time limit per test 2 seconds memory limit per test 256 megabytes input st ...
- Cells Not Under Attack
Cells Not Under Attack Vasya has the square chessboard of size n × n and m rooks. Initially the ches ...
- cf701B Cells Not Under Attack
Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya ...
- Codeforces Round #364
http://codeforces.com/contest/701 A - Cards 水 // #pragma comment(linker, "/STACK:102c000000,102 ...
随机推荐
- SDRAM 学习(三)之command
command 模块总述 SDRAM 的 command 模块的内容包括如下: 1.对初始化请求.配置模式寄存器.读/写.刷新.预充电等命令的一个优先级的控制. 2.对命令执行时间进行控制,依据如图1 ...
- [tools]QuickPing
一款神器 quickping 能够很快的探测出该网断分出去哪些地址. 在线的会显示绿色 在线的+有主机名的显示为亮绿色
- HMAC-MD5算法原理及实现
以下是分析节选,对于更详细的描述可以查阅RFC2104文档. HMAC需要一个加密用散列函数(表示为H)和一个密钥K. 假设H是一个将数据块用一个基本的迭代压缩函数来加密的散列函数. 用B来表 ...
- WebGame开发总结
不知不觉我们的项目开发有2年了,这两年来走了很多弯路,也收获了很多,今天在这里做一个总结. 项目基本情况: 服务器端采用c++和c#混合开发,网络层采用c++开发,业务逻辑用c#开发.客户端采用sil ...
- [USACO2003][poj2112]Optimal Milking(floyd+二分+二分图多重匹配)
http://poj.org/problem?id=2112 题意: 有K个挤奶器,C头奶牛,每个挤奶器最多能给M头奶牛挤奶. 每个挤奶器和奶牛之间都有一定距离. 求使C头奶牛头奶牛需要走的路程的最大 ...
- datepicker自定义 -- iOS
/** * 创建时间选择器 */ - (void)createPickerView { self.datePicker = [[UIDatePicker alloc] init]; _datePick ...
- java模板和回调机制学习总结
最近看spring的JDBCTemplete的模板方式调用时,对模板和回调产生了浓厚兴趣,查询了一些资料,做一些总结. 回调函数: 所谓回调,就是客户程序C调用服务程序S中的某个函数A,然后S又在某个 ...
- struts2升级报ActionContextCleanUp<<is deprecated。Please use the new filters
把web.xml中配置struts.xml的文件改成 <?xml version="1.0" encoding="UTF-8"?> <web- ...
- win8 配 jdk
Win8配置jdk 1.7环境变量 环境:win8(32位)64位差不多 jdk1.7 1.右击计算机-属性-高级系统设置-高级-环境变量,弹出“环境变量”对话框,主要是改下面的环 ...
- iOS开发获取本机手机号码
最近有个奇葩需求,用户登录返回手机号匹配本机号码相同才可以登录,吓得我虎躯一震,经了解,iOS7后不越狱实现不了 "For security reasons, iPhone OS restr ...