Submission #881919

#TimeUsernameProblemLanguageResultExecution timeMemory
881919dostsStar triangles (IZhO11_triangle)C++17
100 / 100
254 ms20412 KiB
#include <bits/stdc++.h> using namespace std; #define sp << " " << #define int long long #define vi vector<int> #define F(xxx,yyy) for (int xxx=1;xxx<=yyy;xxx++) #define pii pair<int,int> const int N = 5e5+1,inf = 1e18; void solve() { int n; cin >> n; map<int,int> xc,yc; vector<pii> ps; F(i,n) { int a,b; cin >> a >> b; xc[a]++; yc[b]++; ps.push_back({a,b}); } int ans = 0; for (auto it : ps) { ans+=(xc[it.first]-1)*(yc[it.second]-1); } cout << ans << endl; } signed main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #ifdef Local freopen("in","r",stdin); freopen("out","w",stdout); #endif int t = 1; //cin >> t; F(i,t) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...