# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
671103 | gavgav | Star triangles (IZhO11_triangle) | C++17 | 272 ms | 12160 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 ll long long
struct point{
int x, y;
};
int main(){
int pointsNumber; scanf("%d", &pointsNumber);
point points[pointsNumber];
map <int, int> pointsInRow, pointsInColumn;
for (int i = 0; i < pointsNumber; ++i){
scanf("%d%d", &(points[i].x), &(points[i].y));
++pointsInRow[points[i].y];
++pointsInColumn[points[i].x];
}
ll trianglesNumber = 0;
for (int i = 0; i < pointsNumber; ++i){
trianglesNumber += (pointsInColumn[points[i].x] - 1) * (pointsInRow[points[i].y] - 1);
}
printf("%lld", trianglesNumber);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |