Submission #335612

#TimeUsernameProblemLanguageResultExecution timeMemory
335612StanCatalinStar triangles (IZhO11_triangle)C++14
0 / 100
1 ms492 KiB
#include <iostream> #include <algorithm> #include <fstream> using namespace std; ifstream in("triangles.in"); ofstream out("triangles.out"); const int dim = 3e5 + 5; int n,lin[dim],col[dim]; pair<int,int> a[dim]; int main() { cin >> n; for (int i=1; i<=n; i++) { cin >> a[i].first >> a[i].second; lin[a[i].first]++; col[a[i].second]++; } int ans = 0; for (int i=1; i<=n; i++) { ans += (lin[a[i].first] - 1) * (col[a[i].second] - 1); } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...