# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
977066 | vjudge1 | Star triangles (IZhO11_triangle) | C++17 | 1 ms | 6492 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |