# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1133869 | tsengang | Star triangles (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... |