# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
171351 | ASDF123 | Star triangles (IZhO11_triangle) | C++14 | 639 ms | 13316 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;
#define all(s) s.begin(), s.end()
#define szof(s) (int)s.size()
#define pii pair<int, int>
#define prev myyyyrza1
#define pb push_back
#define y1 myyyyrza2
#define id id1234
#define fr first
#define sc second
#define OK() puts("OK")
using namespace std;
const int N = ((int)3e5 + 5);
const int MOD = (1e9 + 7);
const int INF = (0x3f3f3f3f);
int X[N], Y[N];
map <int, long long> cntx, cnty;
main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
scanf("%d%d", &X[i], &Y[i]);
cnty[Y[i]]++;
cntx[X[i]]++;
}
long long ans = 0;
for (int i = 1; i <= n; i++) {
int x = X[i], y = Y[i];
ans += (cntx[x] - 1) * (cnty[y] - 1);
}
cout << ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |