LaunchPad
链接:https://ac.nowcoder.com/acm/contest/3665/D
来源:牛客网
The LaunchPad is a touch screen divided into squares of N rows and M columns. Each square has two states of light and shade. And all squares are shady initially. When you touch the square in row X and column Y, the state of all the squares in the row and column will change. Now he wants to know how many squares are light on the LaunchPad after he makes multiple touches.
输入描述:
The first line of input contains two integers N,M(1≤N,M≤1000)N,M (1\leq N,M\leq 1000)N,M(1≤N,M≤1000) denoting the rows and columns of LaunchPad.
The second line of input contains single integer Q(0≤Q≤106)Q (0\leq Q\leq 10^6)Q(0≤Q≤106) denoting the times of touch.
On the next Q lines,describe X and Y - the position of the square being touched. (1≤X≤N,1≤Y≤M)(1\leq X \leq N,1\leq Y\leq M)(1≤X≤N,1≤Y≤M)
输出描述:
Print one line - the number of the squares that is on light state.
说明

题目大意:
就是说一开始n*m矩阵中都是暗的,你可以按压n*m矩阵中任意一个方格,该方格行和列都会变亮,再摁一次会变暗,问m次操作后亮的方格的个数;
解析:
就是行和列的性质不变,但是vis[a][b]会重复
AC代码:
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
inline int read() {int x=,f=;char c=getchar();while(c!='-'&&(c<''||c>''))c=getchar();if(c=='-')f=-,c=getchar();while(c>=''&&c<='')x=x*+c-'',c=getchar();return f*x;}
typedef long long ll;
const int maxn=1e4+;
const int M=1e7+;
const int INF=0x3f3f3f3f;
int vis[][];
int h[maxn];//行
int l[maxn];//列
int main()
{
int n,m,t;
cin>>n>>m>>t;
int a,b;
for(int i=;i<t;i++){
cin>>a>>b;
h[a]++;
l[b]++;
vis[a][b]++;
}
int sum=;
for(int i=;i<=n;i++){
for(int j=;j<=m;j++){
if((h[i]+l[j]-vis[i][j])%==){
sum++;
}
}
}
printf("%d",sum);
return ;
}
LaunchPad的更多相关文章
- Launchpad添加openPGP keys
转自: https://help.ubuntu.com/community/GnuPrivacyGuardHowto mac下: http://notes.jerzygangi.com/the-bes ...
- 应用删除后 Launchpad 上仍有应用图标无法删除的解决方法
应用删除后 Launchpad 上仍有应用图标上带有问号且无法删除时,可以将 launchpad 重置. 在终端输入: defaults write com.apple.dock ResetLaunc ...
- window bzr launchpad 安装配置
1: https://launchpad.net/bzr/2.6/2.6b1/+download/bzr-2.6b1-1-setup.exe 使用Standalone版本 , 安装时选择plugin ...
- CCS v5 无法启动解决办法及Launchpad仿真器电脑无法识别解决方法
安装ccs_setup_5.1.1.00028.exe后(无论是自己装eclipse还是在原来的基础上安装eclipse的插件),ccs5的应用无法打开,错误为:An error has occurr ...
- osx launchpad删除图标
安装了个parallels desktop之后,OSX中的launchpad中的图标多了不少,但是好多都不是我自己想要的,我们该怎么删除或者改动呢,以下介绍一些方法: ①直接操作Appications ...
- Launchpad灰色图标怎么删除?重置Launchpad教程
打开终端,第一步输入:defaults write com.apple.dock ResetLaunchPad -bool true 按下return键 第二步输入:killall Dock 按下re ...
- MAC 调整Launchpad 图标大小
1.调整每一列显示图标数量 defaults write com.apple.dock springboard-rows -int 7 2.调整每一行显示图标数量 defaults write com ...
- Ubuntu 16.04系统下出现E: 无法下载 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found
在安装完成Chrome浏览器后,终端执行以下更新命令 sudo apt-get update 时出现E: 无法下载 http://ppa.launchpad.net/fcitx-team/nightl ...
- 解决 Mac launchpad 启动台 Gitter 图标无法删除的问题
Mac 删除应用非常简单,将应用拖到回收站就删除了.或者进入应用程序文件夹,选中程序,command + delete 就删除了应用,这也是删除文件的快捷键. 但是,安装 Gitter 后,删除了应用 ...
- 解决Mac应用程序软件不出现在Launchpad里面的方法
新装了几个软件,可是打开Lauchpad之后却在里面找不到,真是烦人!然后尝试了以下方法: 1.重启电脑,没用: 2.尝试打开“应用程序(英文名称:Applications)”并找到安装的软件,然后直 ...
随机推荐
- jQuery捕获
获得内容 - text().html() 以及 val() 三个简单实用的用于 DOM 操作的 jQuery 方法: text() - 设置或返回所选元素的文本内容 html() - 设置或返回所选元 ...
- ubuntu19.04 安装mysql,没有初始密码,重设初始密码
1.安装 在终端下输入 sudo apt-get install mysql-server mysql-client 进行安装,如果安装过程中弹出密码输入提示,则正常安装即可! 2.由于没有出现密码设 ...
- deepin linux 安装之后 引导错误 出现 grub>
deepin 安装之后 引导错误 ,,, 忙了一晚上 终于解决了 太辛苦了 不过明白了grub的工作原理也不亏,,,, 就是 整个过程满满的绝望 (哭 环境说明 华硕顽石4 笔记本 硬盘分区表GPT ...
- Apache Kafka(七)- Kafka ElasticSearch Comsumer
Kafka ElasticSearch Consumer 对于Kafka Consumer,我们会写一个例子用于消费Kafka 数据传输到ElasticSearch. 1. 构造ElasticSear ...
- java_基础_关于父类继承的问题
关于java父类继承: 首先抽象类有这样几个规则 1.定义为抽象类的类里可以没有抽象方法 2.抽象类里可以有普通的不带abstract关键字的方法 3.抽象类里可以有主main方法 4.抽象类也可以向 ...
- C# 选取本月周六日方法
用于工作: 1.取本月第一天就是1号 2.取下月第一天再减去一天 就是本月最后一天 3.从月头遍历至月末,判断周几 代码如下: #region 提取本月周六日 DateTime start = new ...
- Django_类视图
1. View 2. tamplate view 3. ListView
- VS调试工具
F5--启动运行,跳到下一个断点 F10--逐步调试 F11--逐句调试 F10和F11的区别: method(); int a = 1; 当程序运行到如上面的method方法时,按F10会直接跳到下 ...
- bootstrap的字体设置
@font-face { font-family: 'Glyphicons Halflings'; src: url('../fonts/glyphicons-halflings-regular.eo ...
- mysql渗透过程
1 打开目标站点:www.xxx.com 2 注册账号并登录,大概找下注入点,没找到 3 用namp -A -T4 目标站点扫描开放的服务 发现mysql等 4 猜弱口令 + 字典 对mysql进行 ...