# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
379680 | SolarSystem | Star triangles (IZhO11_triangle) | C++17 | 502 ms | 18156 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 <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <math.h>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <stdio.h>
#include <numeric>
#include <iomanip>
#include <random>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<pair<long long, long long>> pts(n);
for (int i = 0; i < n; i++) {
cin >> pts[i].first >> pts[i].second;
}
map<long long, long long> mpx;
map<long long, vector<long long>> mpy;
for (int i = 0; i < n; i++) {
mpx[pts[i].first]++;
mpy[pts[i].second].push_back(pts[i].first);
}
long long ans = 0;
for (auto e: mpy) {
long long curr = 0;
for (auto u: e.second) {
curr += mpx[u] - 1;
}
curr *= ((int) e.second.size() - 1);
ans += curr;
}
cout << ans << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |