# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
645588 | ymm | Star triangles (IZhO11_triangle) | C++17 | 307 ms | 8144 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 Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
int main()
{
cin.tie(0) -> sync_with_stdio(false);
int n;
map<int, int> X, Y;
vector<pii> a;
cin >> n;
while (n--) {
int x, y;
cin >> x >> y;
X[x]++;
Y[y]++;
a.push_back({x, y});
}
ll ans = 0;
for (auto [x, y] : a)
ans += (ll)(X[x]-1) * (Y[y]-1);
cout << ans << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |