Submission #87942

#TimeUsernameProblemLanguageResultExecution timeMemory
87942turbatStar triangles (IZhO11_triangle)C++14
100 / 100
870 ms38880 KiB
#include <bits/stdc++.h> using namespace std; #define F first #define S second int n; long long ans; pair <int, int> p[300005]; map <int, int> my, mx; int main (){ //freopen ("input.in", "r", stdin); //freopen ("output.out", "w", stdout); cin >> n; for (int i = 0;i < n;i++){ cin >> p[i].F>> p[i].S; mx[p[i].F]++; my[p[i].S]++; } for (int i = 0;i < n;i++) ans += (mx[p[i].F] - 1) * (my[p[i].S] - 1); cout << ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...