Submission #88620

#TimeUsernameProblemLanguageResultExecution timeMemory
88620toloraiaStar triangles (IZhO11_triangle)C++17
100 / 100
808 ms7520 KiB
#include <bits/stdc++.h> #define F first #define S second #define mp make_pair #define pb push_back #define ll long long #define LEFT(a) ((a)<<1) #define RIGHT(a) (LEFT(a) + 1) #define MID(a,b) ((a+b)>>1) #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) //#define temo using namespace std; const int N = 300007; map < int, int > M1, M2; int n; int x[N], y[N]; ll ans; int main() { cin>>n; for (int i = 1; i <= n; i++){ cin>>x[i]>>y[i]; M1[x[i]]++; M2[y[i]]++; } for (int i = 1; i <= n; i++){ ll p = M1[x[i]] - 1; ll q = M2[y[i]] - 1; ans += p * q; } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...