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 ...
随机推荐
- pycharm界面背景色设置
1. 打开Pycharm点击左上角File,然后选择找到Settings点击进入->搜索Appearance -> 选择Appearance->Background Image 选 ...
- element-ui组件Table排序(sort-by),某些数据无需排序
在列中设置 sortable 属性即可实现以该列为基准的排序, 接受一个 Boolean,默认为 false. 可以通过 Table 的 default-sort 属性设置默认的排序列和排序顺序. 可 ...
- Windows下安装和使用Masscan
http://zone.secevery.com/article/1098 0x00 前言Masscan号称最快的互联网端口扫描器,本文来探测一下Masscan在Windows下的安装和使用.mass ...
- vs 工具 dumpbin & corflags
dumpbin 查看 dll 接口函数 > dumpbin /exports "/path/to/dll" dumpbin 查看 exe.dll 依赖的动态库 > du ...
- 【Linux】有名管道实现进程间通信——一个简单聊天程序
有名管道实现简单聊天程序 1. "你来我往"式简单聊天 函数功能:简单聊天程序,两个程序a和b,a向b发送信息,b接收信息,b向a发送信息,a接收信息:... 源码参考: chat ...
- 常用得cron表达式
0 10 0 1 * ? //每月1号的0:10:00执行 0 01 00 28-31 * ? #月底最后一天早上凌晨1点执行 异常: 查询是否有特殊字符: cat -A ***.sh 解决方法: 1 ...
- 外卖小项目(SpringBook)
一.创建项目,配置maven 二.写配置文件application.yml 三.编写项目启动类 四.设置静态资源路径 基础环境搭建完毕
- Vue.js的使用经验
Vue.js的使用经验 Vue.js的意义 解耦了视图与数据 可复用的组件 前端路由 状态管理 虚拟DOM Vue提供了很多实例属性与方法,都以$开头 $el可以访问挂载Vue实例的元素. $se ...
- (1019) rapidsvn 安装
https://blog.csdn.net/mzpmzk/article/details/106332039
- java轻量级锁、重量级锁、可重入锁、偏向锁、自旋锁的概念
1.重量级锁 作为互斥同步的方式,是最基础的锁,其他的锁都是为了减少开销做的优化,重量级锁借助了monitor 对象,monitor对象中有三个区域,分别是entity site. owner和wai ...