Submission #609286

#TimeUsernameProblemLanguageResultExecution timeMemory
609286mannshah1211Star triangles (IZhO11_triangle)C++14
100 / 100
388 ms14164 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n; cin >> n; ll x[n]; ll y[n]; for(ll i = 0; i < n; i++){ cin >> x[i] >> y[i]; } unordered_map <ll, ll> freqX; unordered_map <ll, ll> freqY; ll ans = 0; for(ll i : x){ freqX[i] = 0; } for(ll i : y){ freqY[i] = 0; } for(ll i : x){ freqX[i]++; } for(ll i : y){ freqY[i]++; } for(ll i = 0; i < n; i++){ ans += (freqX[x[i]] - 1)*(freqY[y[i]] - 1); } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...