Submission #382321

#TimeUsernameProblemLanguageResultExecution timeMemory
382321knightron0Star triangles (IZhO11_triangle)C++14
100 / 100
552 ms12728 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define fr first #define sc second #define clr(a, x) memset(a, x, sizeof(a)) #define dbg(x) cout<<"("<<#x<<"): "<<x<<endl; #define printvector(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout<<*it<<" "; cout<<endl; #define all(v) v.begin(), v.end() #define lcm(a, b) (a * b)/__gcd(a, b) #define int long long int #define printvecpairs(vec) for(auto it: vec) cout<<it.fr<<' '<<it.sc<<endl; #define endl '\n' #define float long double const int MOD = 1e9 + 7; const int INF = 2e15; const int MAXN = 1e5 + 5; map<int, int> cntx, cnty; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); #ifdef LOCAL freopen("input.txt", "r", stdin); #endif int n; cin>>n; vector<pair<int, int>> v; for(int i = 0;i<n;i++){ int t1, t2; cin>>t1>>t2; v.pb({t1, t2}); cntx[t1]++; cnty[t2]++; } int ans = 0; for(auto it: v){ ans += (cntx[it.fr]-1) * (cnty[it.sc]-1); } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...