# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
212870 | islingr | Star triangles (IZhO11_triangle) | C++14 | 360 ms | 12456 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 <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;
#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define per(i, a, b) for (auto i = (b) - 1; i >= (a); --i)
#define trav(x, v) for (auto &x : v)
#define ff first
#define ss second
using ll = int64_t;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
vector<pair<int, int>> v(n);
map<int, int> x, y;
trav(p, v) {
cin >> p.ff >> p.ss;
++x[p.ff]; ++y[p.ss];
}
ll ans = 0;
trav(p, v) ans += 1ll * (x[p.ff] - 1) * (y[p.ss] - 1);
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |