# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
88620 | toloraia | Star triangles (IZhO11_triangle) | C++17 | 808 ms | 7520 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 F first
#define S second
#define mp make_pair
#define pb push_back
#define ll long long
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
//#define temo
using namespace std;
const int N = 300007;
map < int, int > M1, M2;
int n;
int x[N], y[N];
ll ans;
int main()
{
cin>>n;
for (int i = 1; i <= n; i++){
cin>>x[i]>>y[i];
M1[x[i]]++;
M2[y[i]]++;
}
for (int i = 1; i <= n; i++){
ll p = M1[x[i]] - 1;
ll q = M2[y[i]] - 1;
ans += p * q;
}
cout<<ans<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |