#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. 窗口退出&初始化

    class Test(QtWidgets.QMainWindow, Ui_dlg): def closeEvent(self, e): #to do super().closeEvent(e) def ...

  2. P1002 [NOIP2002 普及组] 过河卒

    P1002 [NOIP2002 普及组] 过河卒 题目见上. 一个经典的递推题 递推不会的看下面: https://www.cnblogs.com/haoningdeboke-2022/p/16247 ...

  3. Unity UI 识别画圆手势

    最近做了一个项目,需要打开一个编辑UI,平时不显示,如果在UI界面上做一个按钮,感觉很丑,就想到了Reporter_Logs的画圆触发. 识别到你在界面上画了一个圆 (可用于 Windows 和 An ...

  4. 蓝牙mesh组网实践(手机配网例程配合wch mesh手机app的使用)

    目录 CH582的官方EVT在22年7月更新后,修改了手机配网代码以支持wch mesh手机app.使用该app可以保存手动配网信息,设置订阅地址分组,OTA升级,极大方便了用户管理节点. 老版本的E ...

  5. Visual Studio Code 如何设置成中文语言

    Visual Studio Code 是一款微软的代码编辑器,这款软件是比较不错的,用起来也比较方便,但是好多人在第一次安装的时候展现的是英文的,这对于一些小伙伴是比较头疼的问题,那如何调整为中文的呢 ...

  6. scp 和 rsync

    scp 和 rsync指令的区别 相同点两者都可以被用来进行数据同步 不同点 : 对于scp来讲 是全量复制 以当前主机为准 将相同的文件拷贝到另一台机器上 rsync 可以识别增量的内容,可以仅仅对 ...

  7. react lodash节流this找不到正确用法

    if (!this.throttleLoadDicom) { this.throttleLoadDicom = throttle(this.loadDicomFun, 800, { leading: ...

  8. 普罗米修斯-docker安装

    1.只有一台服务器,所以使用docker来进行试验 #安装dockercurl -fsSL https://get.docker.com | bash -s docker --mirror Aliyu ...

  9. Java基础——IO模型详解

  10. VC如何创建C编译器能使用的动态库

    方法 使用extern "C"修饰 设置统一的调用约定 举例 例1--使用__cdecl,一般C编译器使用此约定,如LabWidnows/CVI. cpp代码 extern &qu ...