# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
381531 | ismoilov | Star triangles (IZhO11_triangle) | C++14 | 405 ms | 13292 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>
using namespace std;
typedef long long ll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
#define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
#define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--)
#define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--)
const int MAXX = 3e5+5;
int x[MAXX], y[MAXX];
map <ll, ll> a, b;
void S()
{
ll n, ans = 0;
cin >> n;
fpp(i,1,n)
{
cin >> x[i] >> y[i];
a[x[i]]++;
b[y[i]]++;
}
fpp(i,1,n)
{
ans += 1LL * (a[x[i]]-1)*(b[y[i]]-1);
}
cout << ans;
}
int main()
{
IOS;
S();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |