Submission #532930

#TimeUsernameProblemLanguageResultExecution timeMemory
532930christinelynnStar triangles (IZhO11_triangle)C++17
100 / 100
518 ms12140 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<int, int> mpx; map<int, int> mpy; pair<int, int> coor[n+5]; for(int i = 1; i<=n; i++) { int a, b; cin >> a >> b; coor[i] = {a, b}; mpx[a]++; mpy[b]++; } long long total1 = 0; for(int i = 1; i<=n; i++) { total1 += 1ll*(mpx[coor[i].first]-1)*(mpy[coor[i].second]-1); } cout << total1 << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...