Submission #968570

#TimeUsernameProblemLanguageResultExecution timeMemory
968570vjudge1Star triangles (IZhO11_triangle)C++17
100 / 100
242 ms12112 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 3e5; int N; int X[MAXN + 5], Y[MAXN + 5]; map<int, int> cntX, cntY; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> N; for (int i = 0; i < N; i++) { cin >> X[i] >> Y[i]; cntX[X[i]]++; cntY[Y[i]]++; } long long ans = 0; for (int i = 0; i < N; i++) { ans += 1ll * (cntX[X[i]] - 1) * (cntY[Y[i]] - 1); } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...