# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
38149 | 14kg | Star triangles (IZhO11_triangle) | C++11 | 679 ms | 6552 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 <stdio.h>
#include <map>
using namespace std;
int n;
pair<int, int> in[300001];
map<int, int> X, Y;
int main() {
long long cnt = 0, t1, t2;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d %d", &in[i].first, &in[i].second);
X[in[i].first]++, Y[in[i].second]++;
}
for (int i = 1; i <= n; i++) {
t1 = X[in[i].first] - 1, t2 = Y[in[i].second] - 1;
cnt += t1*t2;
}
printf("%d", cnt);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |