# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
523928 | Bill_00 | Star triangles (IZhO11_triangle) | C++14 | 147 ms | 11836 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>
#define MOD 1000000007
typedef long long ll;
using namespace std;
int x[1000000], y[1000000];
unordered_map<int, ll> um[2];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
for(int i = 1; i <= n; i++){
cin >> x[i] >> y[i];
um[0][x[i]]++;
um[1][y[i]]++;
}
ll ans = 0;
for(int i = 1; i <= n; i++){
ans += ((um[0][x[i]] - 1) * (um[1][y[i]] - 1));
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |