# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
165995 | Gurban | Star triangles (IZhO11_triangle) | C++11 | 1043 ms | 15864 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>
#define pb push_back
#define ss second
#define ff first
#define N 100005
#define inf 1000000009
#define ll long long
#define mid(a,b) (a+b)/2
using namespace std;
ll n;
ll sum;
pair <ll,ll> a[3 * N];
map <ll,ll> m,p;
map <pair<int,int>,int> k;
int main()
{
cin >> n;
for(int i = 1;i <= n;i++){
cin >> a[i].ff >> a[i].ss;
m[a[i].ff]++;
p[a[i].ss]++;
}
for(int i = 1;i <= n;i++)
sum += ((m[a[i].ff] - (ll)1) * (p[a[i].ss] - (ll)1));
cout << sum << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |