#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例题)的更多相关文章

  1. codeforces 651C(map、去重)

    题目链接:http://codeforces.com/contest/651/problem/C 思路:结果就是计算同一横坐标.纵坐标上有多少点,再减去可能重复的数量(用map,pair存一下就OK了 ...

  2. Watchmen CodeForces - 650A

    Watchmen CodeForces - 650A Watchmen are in a danger and Doctor Manhattan together with his friend Da ...

  3. Go map例题

    package main import "fmt" //map例题 //寻找最长不含有重复字符的子串 // abcabcbb -> abc //pwwkew ->wke ...

  4. CodeForces 651C Watchmen map

    Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn t ...

  5. 【CodeForces - 651C 】Watchmen(map)

    Watchmen 直接上中文 Descriptions: 钟表匠们的好基友马医生和蛋蛋现在要执行拯救表匠们的任务.在平面内一共有n个表匠,第i个表匠的位置为(xi, yi). 他们需要安排一个任务计划 ...

  6. codeforces 651C Watchmen

    Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn t ...

  7. CodeForces - 651C Watchmen (去重)

    Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn t ...

  8. Codeforces 651C Watchmen【模拟】

    题意: 求欧几里得距离与曼哈顿距离相等的组数. 分析: 化简后得到xi=xj||yi=yj,即为求x相等 + y相等 - x与y均相等. 代码: #include<iostream> #i ...

  9. CodeForces 651C

    Description Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg s ...

  10. A. Watchmen(Codeforces 650A)

    A. Watchmen time limit per test 3 seconds memory limit per test 256 megabytes input standard input o ...

随机推荐

  1. vue部署样式错乱

    1 <style scoped> 2 .el-menu-vertical-demo:not(.el-menu--collapse) { 3 border: none; 4 } 5 .sub ...

  2. etcdctl 安装与使用

    介绍 etcdctl是一个提供简洁命令的etcd客户端,使用etcdctl可以直接和etcd服务打交道,对etcd中的键值对进行增删改查. 安装etcdctl 下载etcdctl工具 下载地址:etc ...

  3. Unity3D使用脚本动态创建、调用动画(转)

    原文链接: https://blog.csdn.net/pigautumn/article/details/81781403 需求场景:由若干个数量不确定的物体从上到下排列,需要间隔0.1s依次从左到 ...

  4. 通过curl获取当前机器IPv6的外网地址

    curl -XPOST -vB -6 -g "https://10086.cn/web-Center/commonservice/getUserIp.do" -H "Re ...

  5. LWC-001_Event

    文章来源: Events (lwc.dev) 1. 监控子组件的动作: Child.html <template> <button>Click</button> & ...

  6. pg9.6查询优化

    目录 1 样例数据集 2 explain基础 3 执行计划节点结构 3.1 基本代价计算 3.2 执行计划格式输出 4 组装行集合 4.1 扫描方式 4.2 处理节点 1 样例数据集 wget htt ...

  7. wireshark作业

    1Wireshark基本操作: 1.启动wireshark,正确选择混杂模式,访问任意网站: 2.设置过滤器呈现本地和该网站服务器之间的交互报文: 3.保存抓包结果文件.cap: 4.在作业纸上记录下 ...

  8. Python的入门学习之Day 9——from“夜曲编程”

    Day 9 time: 2021.8.6. 昨天复习了第一章"数据与运算".第二章"条件判断"的相关重点,今天就感觉得心应手了.今天上新的内容是关于新一章节&q ...

  9. python爬虫cookies jar与字典转换

    #将CookieJar转为字典: cookies = requests.utils.dict_from_cookiejar(r.cookies) #将字典转为CookieJar: cookies = ...

  10. 浅谈Atlassian产品搭建的敏捷管理体系(一)概述

    准备把敏捷管理的专题在今年完成,主要谈一下Atlassian的实践,先做一下搬运工,讲去年写的两篇弄过来. Dream big, work smart, deliver fast 使用Atlassia ...