# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
293861 | 7_7_7 | Star triangles (IZhO11_triangle) | C++17 | 2 ms | 384 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;
int n;
map<int, int> x;
map<int, int> y;
int main()
{
ios_base::sync_with_stdio(false);
freopen("triangles.in", "r", stdin);
freopen("triangles.out", "w", stdout);
cin >> n;
vector<int> a(n + 1), b(n + 1);
for(int i = 1; i <= n; i ++){
cin >> a[i] >> b[i];
x[a[i]] ++; y[b[i]] ++;
}
long long res = 0;
for(int i = 1; i <= n; i ++){
x[a[i]] --; y[b[i]] --;
res += (x[a[i]] * 1ll * y[b[i]]);
x[a[i]] ++; y[b[i]] ++;
}
cout << res << "\n";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |