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 ...
随机推荐
- npm报错最好的办法就是删掉依赖然后重装
之前有个node工程,现在要新增antd主题,那得增加安装 craco 并修改 package.json 里的 scripts 属性 改吧改,安装一直报错: Cannot find module 'w ...
- css实现水波纹
携手创作,共同成长!这是我参与「掘金日新计划 · 8 月更文挑战」的第23天,点击查看活动详情 ui设计的元素有时候需要有一些动画效果,可以直接用css动画来实现. 实现一个中心圆向四周有水波纹的效果 ...
- ElasticSearch、ElasticSearch-head的安装和问题解决
前言:elasticsearch作为一个基于Lucene的分布式搜索引擎,其搜索功能的强大之处不用多说,而elasticsearch-head作为一个node项目,能够轻松管理elasticsearc ...
- TensorFlow学习报告
TensorFlow简介 是一个基于计算图的深度学习库,具有更广泛的应用领域.良好的多语言支持.部署性能等优点,时现今最广泛使用的深度学习框架. 计算图Session Tensor 1 import ...
- kafka数据顺序一致
问题: kafka如何发送顺序消息 方案:kafka可以通过partitionKey,将某类消息写入同一个partition,一个partition只能对应一个消费线程,以保证数据有序. 也就是说生产 ...
- sql常用系统存储过程
-- 更详细的介结参考联机帮助文档 xp_cmdshell --*执行DOS各种命令,结果以文本行返回. xp_fixeddrives --*查询各磁盘/分区可用空间 xp_loginconfig - ...
- C语言源文件如何编译为exe
先观看https://blog.csdn.net/u014772182/article/details/43348465来配置gcc环境随后在cmd中cd到目标文件夹gcc main.c -o ste ...
- TCP通信实现两个主机之间的信息交互
TCP通信概述TCP协议用来控制两个网络设备之间的点对点通信,两端设备按作用分为客户端和服务端.服务端为客户端提供服务,通常等待客户端的请求信息,有客户端请求到达之后,及时提供服务和返回响应消息:客户 ...
- QueryDet: Cascaded Sparse Query for Accelerating High-Resolution Small Object Detection(QueryDet:用于加速高分辨率小目标检测的级联稀疏查询)
QueryDet: Cascaded Sparse Query for Accelerating High-Resolution Small Object Detection(QueryDet:用于加 ...
- Wix Setting language and code page attributes
When you localize your MSI package, you'll need to alter your Productand Package elements to suit. T ...