Submission #88529

#TimeUsernameProblemLanguageResultExecution timeMemory
885291KhanStar triangles (IZhO11_triangle)C++14
100 / 100
553 ms12140 KiB
// In the name of GOD #include <bits/stdc++.h> using namespace std; #define good exit(0); #define nl endl #define ios ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0); #define sz(s) (int)s.size() #define all(s) s.begin(), s.end() #define pb push_back #define bb begin() #define ee end() #define ff first #define ss second #define ll long long #define db double #define pii pair<int, int> const int N = 3e5 + 555; int n; map<int, int> m, k; int a[N], b[N]; int main(){ ios cin >> n; for(int i = 1; i <= n; ++i){ cin >> a[i] >> b[i]; m[a[i]]++; k[b[i]]++; } int ans = 0; for(int i = 1; i <= n; ++i){ int q = m[a[i]] - 1; int w = k[b[i]] - 1; ans += (q * w); } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...