# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
971330 | vjudge1 | Star triangles (IZhO11_triangle) | C++17 | 922 ms | 34436 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>
using namespace std;
#define int long long
signed main(){
int n;
cin>>n;
pair<int,int>kartesius[n+1];
map<int,int >y;
map<int,int>x;
map<pair<int,int>,int> cek;
for(int j=1;j<=n;j++ ){
cin>>kartesius[j].first>>kartesius[j].second;
int q=kartesius[j].first;
int w=kartesius[j].second;
if(cek[{q,w}]!=1){
cek[{q,w}]=1;
if(!x.count(q)){
x[q]=1;
}
else{
x[q]++;
}
if(!y.count(w)){
y[w]=1;
}
else{
y[w]++;
}
}
}
int ans=0;
for(int k=1;k<=n;k++){
int hori=kartesius[k].first;
int ver=kartesius[k].second;
if(cek[{hori,ver}]==1){
ans+=(x[hori]-1)*(y[ver]-1);
cek[{hori,ver}]=2;
}
}
// cout<<cek[{1,1}]<<endl;
cout<<ans<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |