# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
412675 | tempus | Star triangles (IZhO11_triangle) | C++17 | 3 ms | 332 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 ll long long
#define endl "\n"
#define ios ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
using namespace std;
int main() {
ios
freopen("triangles.out", "w", stdout);
freopen("triangles.in", "r", stdin);
int n;
cin >> n;
ll x[n], y[n];
map <ll, ll> m1, m2;
for (int i = 0; i < n; ++ i) {
cin >> x[i] >> y[i];
m1[x[i]] ++;
m2[y[i]] ++;
}
ll ans = 0;
for (int i = 0; i < n; ++ i) {
ans += (m1[x[i]] - 1) * (m2[y[i]] - 1);
}
cout << ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |