Submission #975869

#TimeUsernameProblemLanguageResultExecution timeMemory
975869vjudge1Star triangles (IZhO11_triangle)C++17
100 / 100
205 ms11808 KiB
#include<bits/stdc++.h> using namespace std; int main() { int N; cin >> N; unordered_map<int, int> xCount, yCount; vector<pair<int, int>> points(N); for (int i = 0; i < N; ++i) { int x, y; cin >> x >> y; points[i] = make_pair(x, y); xCount[x]++; yCount[y]++; } long long totalCount = 0; for (auto point : points) { int x = point.first; int y = point.second; int sameX = xCount[x]; int sameY = yCount[y]; totalCount += (long long)(sameX - 1) * (sameY - 1); } cout << totalCount << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...