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 ...
随机推荐
- 肖sir__整理项目链接
项目链接: https://www.cnblogs.com/xiaolehong/p/16460523.html 保险项目https://www.cnblogs.com/xiaolehong/p/16 ...
- matplotlib 在同一张图中显示两种图例
L1=plt.legend(['ManyShot','FewShot'],loc='upper left') #保存为L1 plt.legend(['ManyShot','FewShot'],loc= ...
- js把一个数组的数据平均到几个数组里面
arr 原始数组数据 count 每个数组里面元素个数 function splitIpLit(arr,count) { let i = 0; let newArr = []; while(i &l ...
- 【个人笔记】CentOS 修改 SSH 端口, 禁止 ROOT 远程登陆
1. 修改 SSH 端口号, 禁止 ROOT 用户远程登录 # 使用ROOT用户或者其他有权限的用户登录 # 首先新建一个普通用户,避免禁用 ROOT 用户远程登陆后自己也无法登陆, 已有用户可以跳过 ...
- mysql生成随机数的函数
例:update [tablename] set [columnname] = FLOOR( 6546541 + RAND() * (987987989 - 6546541)) where ? FLO ...
- Workbench download Document
1. package.xml <?xml version="1.0" encoding="UTF-8"?> <Package xmlns=&q ...
- netmiko批量操作网络设备_pandas版
from concurrent.futures import ThreadPoolExecutor import netmiko import os from threading import Loc ...
- Pytest初识
一.单元测试框架简介 1. 什么是单元测试 单元测试是指在软件开发过程中,针对软件的最小单位(函数,方法)进行正确性的检查测试. 2. 常用单元测试框架 2.1 Java 类别 junit testn ...
- 如何在Axure RP 8.0 中打开页面指定的动态面板
有时在制作原型的时候,需要打开另一个页面指定的动态面板,研究了一下分享给大家 方法/步骤 1.打开Axure RP 8.0,在index面面中拖出来一个按钮,写上文字"打开page1/sta ...
- Pytorch实战学习(五):多分类问题
<PyTorch深度学习实践>完结合集_哔哩哔哩_bilibili Softmax Classifer 1.二分类问题:糖尿病预测 2.多分类问题 MNIST Dataset:10个标签, ...