# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1167928 | CrabCNH | 별들과 삼각형 (IZhO11_triangle) | C++20 | 446 ms | 23328 KiB |
#include <bits/stdc++.h>
#define task "BriantheCrab"
#define int long long
#define pii pair <int, int>
#define fi first
#define se second
#define szf sizeof
#define sz(s) (int)((s).size())
using namespace std;
template <class T> void mini (T &t, T f) {if (t > f) t = f;}
template <class T> void maxi (T &t, T f) {if (t < f) t = f;}
const int maxN = 1e5 + 5;
const int inf = 1e18 + 7;
const int mod = 1e9 + 7;
map <pii, int> mp;
map <int, int> t1, t2;
void solve () {
int n;
cin >> n;
for (int i = 1; i <= n; i ++) {
int x, y;
cin >> x >> y;
mp[{x, y}] ++;
}
for (auto [a, _] : mp) {
auto [x, y] = a;
t1[x] ++;
t2[y] ++;
}
int res = 0;
for (auto [a, _] : mp) {
auto [x, y] = a;
res += (t1[x] - 1) * (t2[y] - 1);
}
cout << res;
}
signed main () {
cin.tie (nullptr) -> sync_with_stdio (false);
if (fopen (task".inp", "r")) {
freopen (task".inp", "r", stdin);
freopen (task".out", "w", stdout);
}
int t = 1;
//cin >> t;
while (t --) {
solve ();
}
return 0;
}
// thfdgb
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |