Submission #975151

#TimeUsernameProblemLanguageResultExecution timeMemory
975151vjudge1Star triangles (IZhO11_triangle)C++17
100 / 100
391 ms14320 KiB
#include <bits/stdc++.h> using namespace std; const int maxN = 3e5+7; int main(){ int q; cin >> q; long long x[maxN], y[maxN]; map<int, int> cntX, cntY; for(int i = 0; i < q; i++) { cin >> x[i] >> y[i]; cntX[x[i]]++; cntY[y[i]]++; } long long ans = 0; for(int i = 0; i < q; i++){ ans += (cntX[x[i]] - 1) * (cntY[y[i]] - 1); } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...