제출 #1219581

#제출 시각아이디문제언어결과실행 시간메모리
1219581lizi14별들과 삼각형 (IZhO11_triangle)C++20
100 / 100
222 ms5864 KiB
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n; cin>>n; map<int,int>mp1,mp2; vector<pair<int,int>>v(n); for(int i=0; i<n; i++){ int j,k; cin>>j>>k; mp1[j]++; mp2[k]++; pair<int,int>p={j,k}; v[i]=p; } long long ans=0; sort(v.begin(),v.end()); for(int i=0; i<v.size(); i++){ long long ans1=mp1[v[i].first]-1; long long ans2=mp2[v[i].second]-1; ans+=(ans1*ans2); //cout<<ans1<<" "<<ans2<<endl; } cout<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...