# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
971330 | vjudge1 | Star triangles (IZhO11_triangle) | C++17 | 922 ms | 34436 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |