# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
601104 | kabika | Star triangles (IZhO11_triangle) | C++14 | 501 ms | 20292 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 x first
#define y second
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
map<int,vector<int>> xfx, yfx;
vector<pair<int,int>> st(n);
for(int i = 0; i < n; ++i)
{
cin >> st[i].x >> st[i].y;
xfx[st[i].x].push_back(st[i].y);
yfx[st[i].y].push_back(st[i].x);
}
ll ans = 0;
for(int i = 0; i < n; ++i)
{
ll t = (xfx[st[i].x].size() - 1)*(yfx[st[i].y].size() - 1);
//cout << t << '\n';
ans += t;
}
cout << ans << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |