C - Watchmen CodeForces - 651C (使用map例题)
#include<iostream>#include<map> using namespace std;map<int,int> x;map<int,int> y;map<pair<int,int>,int> xy;int main(){ int n; cin>>n; for(int i=0;i<n;++i) { int xx,yy; scanf("%d%d",&xx,&yy); ++x[xx]; ++y[yy]; ++xy[make_pair(xx,yy)]; } long long ans=0; for(auto i : x) ans+=(long long)i.second*((long long)i.second-1)/2; for(auto i : y) ans+=(long long)i.second*((long long)i.second-1)/2; for(auto i : xy) ans-=(long long)i.second*((long long)i.second-1)/2; printf("%lld",ans); }
C - Watchmen CodeForces - 651C (使用map例题)的更多相关文章
- codeforces 651C(map、去重)
题目链接:http://codeforces.com/contest/651/problem/C 思路:结果就是计算同一横坐标.纵坐标上有多少点,再减去可能重复的数量(用map,pair存一下就OK了 ...
- Watchmen CodeForces - 650A
Watchmen CodeForces - 650A Watchmen are in a danger and Doctor Manhattan together with his friend Da ...
- Go map例题
package main import "fmt" //map例题 //寻找最长不含有重复字符的子串 // abcabcbb -> abc //pwwkew ->wke ...
- CodeForces 651C Watchmen map
Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn t ...
- 【CodeForces - 651C 】Watchmen(map)
Watchmen 直接上中文 Descriptions: 钟表匠们的好基友马医生和蛋蛋现在要执行拯救表匠们的任务.在平面内一共有n个表匠,第i个表匠的位置为(xi, yi). 他们需要安排一个任务计划 ...
- codeforces 651C Watchmen
Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn t ...
- CodeForces - 651C Watchmen (去重)
Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn t ...
- Codeforces 651C Watchmen【模拟】
题意: 求欧几里得距离与曼哈顿距离相等的组数. 分析: 化简后得到xi=xj||yi=yj,即为求x相等 + y相等 - x与y均相等. 代码: #include<iostream> #i ...
- CodeForces 651C
Description Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg s ...
- A. Watchmen(Codeforces 650A)
A. Watchmen time limit per test 3 seconds memory limit per test 256 megabytes input standard input o ...
随机推荐
- python 操作配置文件(configparser模块)
用于生成和修改常见配置文档,当前模块的名称在 python 3.x 版本中变更为 configparser 配置文件信息: [DEFAULT] ServerAliveInterval = 45 Com ...
- 1970:【15NOIP普及组】扫雷游戏
1970:[15NOIP普及组]扫雷游戏 时间限制: 1000 ms 内存限制: 131072 KB提交数: 5638 通过数: 3495 [题目描述] 扫雷游戏是一款十分经典 ...
- 使用JIMO ActionOne HongHu 及其他MR VR眼镜,将真实场景和游戏内场景混合渲染
1. 在VR相机Head内创建一个 Camera 和两个RawImage(Camera 的参数和VRCamera的参数一致, 两个RawImage尺寸一致, 要把VRCamera的相机遮挡住 ) 2. ...
- 创建异步倒计时触发Task
https://www.cnblogs.com/shanfeng1000/p/13402152.html //Task关闭 CancellationTokenSource cancel = new C ...
- leecode72. 编辑距离
72. 编辑距离 给你两个单词 word1 和 word2, 请返回将 word1 转换成 word2 所使用的最少操作数 . 你可以对一个单词进行如下三种操作: 插入一个字符 删除一个字符 替换一个 ...
- 一种改进后的turf.idw算法
turf 是Advanced geospatial analysis geojson data in javascript. 官网:http://turfjs.org/ 针对github 中的源码. ...
- vue用echarts不显示
在html页面中套vue的情况来使用echarts,或者单独vue使用echarts,出现页面不渲染图表,代码渲染有的情况,加个this.$nextTick(()=>{})让他主动渲染一下就可以 ...
- vue项目搭建(vue2+elementUI+less)
装node.js然后控制台输入node -v有版本号就是成功了 如是是windows系统建议装个git ,我这边习惯用命令行了 按照vue 和vue-cli vue-cli是一个vue的脚手架 按照提 ...
- 数据仓库服务 GaussDB(DWS)
官网:总体介绍 https://support.huaweicloud.com/dws/index.html 部分源码解读 https://my.oschina.net/gaussdb?tab=new ...
- python40
Python Number 数据类型用于存储数值. 数据类型是不允许改变的,这就意味着如果改变 Number 数据类型的值,将重新分配内存空间. 以下实例在变量赋值时 Number 对象将被创建: v ...