# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1219528 | theiulius | Star triangles (IZhO11_triangle) | C++20 | 463 ms | 20132 KiB |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define ff first
#define ss second
#define pb push_back
int n;
const int N = 2e5+5;
main(){
/*ifstream cin(".in");
ofstream cout(".out");*/
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
map<int, vector<int>> xs, ys;
int x[n] = {}, y[n] = {};
for (int i = 0; i < n; i++){
cin >> x[i] >> y[i];
xs[y[i]].pb(x[i]);
ys[x[i]].pb(y[i]);
}
int ans = 0;
for (int i = 0; i < n; i++){
ans += (xs[y[i]].size() - 1) * (ys[x[i]].size() - 1);
}
cout << ans << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |