Submission #977066

#TimeUsernameProblemLanguageResultExecution timeMemory
977066vjudge1Star triangles (IZhO11_triangle)C++17
0 / 100
1 ms6492 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; //masukin nilai n; trus masukin nilai Xi dan Yi ke array;; //cari banyak titik yang Xnya sama dengan Xi; dan Ynya sama dengan Yi, terus kaliin; //tambahin ke ans; const int a=3e5; ll x[a + 5], y[a + 5]; ll cntX[a+5], cntY[a+5]; int main(){ ll n; cin>>n; for(ll i=0; i<n; i++){ cin>>x[i]>>y[i]; cntX[x[i]]++; cntY[x[i]]++; } ll ans=0; for(ll i=0; i<n; i++){ ans+=(cntX[x[i]]-1)*(cntY[y[i]]-1); } cout<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...