• CodeForces


    CodeForces - 651C

    自己写的感觉对了,但第三组数据老说输出27,正确答案是33,可在本地测了很多遍都是正确答案,就不知道怎么搞的了。比赛完后就换了种形式就过了。

     1 #include <bits/stdc++.h>
     2 #define ll long long
     3 using namespace std;
     4 typedef pair<int,int> P;
     5 map<int,int> xx,yy;
     6 map<P,int> s;
     7 map<int,int>::iterator it1;
     8 map<P,int>::iterator it2;
     9 int main(){
    10     int n;
    11     scanf("%d",&n);
    12     for(int i = 1; i <= n; i ++){
    13         int a,b;
    14         scanf("%d%d",&a,&b);
    15         xx[a]++;yy[b]++;
    16         s[P(a,b)]++;
    17     }
    18     ll ans = 0;
    19     for(it1 = xx.begin(); it1!=xx.end(); it1++){
    20         ans += (ll)(*it1).second*((*it1).second-1)/2;
    21     }
    22     for(it1 = yy.begin(); it1!=yy.end(); it1++){
    23         ans += (ll)(*it1).second*((*it1).second-1)/2;
    24     }
    25     for(it2 = s.begin(); it2!=s.end(); ++it2){
    26         ans -= (ll)(*it2).second*((*it2).second-1)/2;
    27     }
    28     cout << ans << endl;
    29     return 0;
    30 }
  • 相关阅读:
    Spark参数优化
    Spark性能优化指南
    Durid的特点
    优秀博客地址
    Kylin的特点
    2017/11/20
    堆、栈、静态存储
    arraylist 和 linkedlist 的区别
    青岛项目遇到的问题
    access specifier
  • 原文地址:https://www.cnblogs.com/xingkongyihao/p/7112508.html
Copyright © 2020-2023  润新知