# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
897066 | ach00 | Star triangles (IZhO11_triangle) | C++14 | 422 ms | 19804 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 X second
#define Y first
int main() {
vector<pair<long long,long long>> stars;
map<long long, int> x_count;
map<long long, int> y_count;
int n; cin >> n;
for(int i = 0; i < n; i++) {
int x,y; cin >> x >> y;
stars.push_back({y,x});
x_count[x]++;
y_count[y]++;
}
long long ans = 0;
for(int i = 0; i < n; i++) {
ans += max((x_count[stars[i].X]-1),0)*max((y_count[stars[i].Y]-1),0);
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |