Submission #421955

#TimeUsernameProblemLanguageResultExecution timeMemory
421955sikamax2019Star triangles (IZhO11_triangle)C++14
100 / 100
168 ms14244 KiB
#include <bits/stdc++.h> using namespace std; #define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define mp make_pair #define pb push_back #define ll long long #define ld long double #define fs first #define sc second #define debug(x) cout << '[' << #x << " is: " << x << "] " << endl; #define sz(x) (int)(x).size() #define int long long #define all(x) x.begin(), x.end() int gcd(int a,int b){ return b==0?a:gcd(b,a%b); } int lcm(int a,int b){ return a*b/gcd(a,b); } const int mod =1e9+7; const ll N = 3e5 + 9; unordered_map<ll,ll> mpx,mpy; int n,ans; pair<int ,int >a[N]; int32_t main() { IOS; int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].fs>>a[i].sc; mpx[a[i].fs]++; mpy[a[i].sc]++; } int ans=0; for (int i = 1;i <= n;i++){ int p = mpx[a[i].fs] - 1,q = mpy[a[i].sc] - 1; ans+=p*q; } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...