Submission #4874

#TimeUsernameProblemLanguageResultExecution timeMemory
4874aintaStar triangles (IZhO11_triangle)C++98
100 / 100
476 ms6588 KiB
#include<stdio.h> #include<algorithm> #include<map> using namespace std; map<int, int>Map1, Map2; int n, w[300010][2], i; long long R; int main() { scanf("%d", &n); for (i = 0; i < n; i++){ scanf("%d%d", &w[i][0], &w[i][1]); Map1[w[i][0]]++, Map2[w[i][1]]++; } for (i = 0; i < n; i++){ R = R +(long long)(Map1[w[i][0]] - 1)*(Map2[w[i][1]] - 1); } printf("%lld\n", R); }
#Verdict Execution timeMemoryGrader output
Fetching results...