Submission #1100556

#TimeUsernameProblemLanguageResultExecution timeMemory
1100556vjudge1Star triangles (IZhO11_triangle)C++17
100 / 100
206 ms5376 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int n; cin>>n; unordered_map<int, int> cntx, cnty; pair<int, int> stars[n]; for (int i = 0; i < n; i++) { int x, y; cin>>x>>y; stars[i] = {x, y}; cntx[x]++; cnty[y]++; } ll total = 0; for (int i = 0; i < n; i++) { int x = stars[i].first; int y = stars[i].second; total += (cntx[x]-1) * (cnty[y]-1); } cout<<total<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...