# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1133869 | tsengang | 별들과 삼각형 (IZhO11_triangle) | C++20 | 399 ms | 9208 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ertunt return
int main(){
map<ll,ll>m;
map<ll,ll>mp;
ll n;
cin >> n;
ll a[n],b[n];
for(ll i = 0; i < n; i++){
cin >> a[i] >> b[i];
m[a[i]]++;
mp[b[i]]++;
}
ll ans = 0;
for(ll i = 0; i < n; i++){
ans+=m[a[i]]*mp[b[i]] - m[a[i]] - mp[b[i]]+1;
}
cout << ans << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |