# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975623 | vjudge1 | Star triangles (IZhO11_triangle) | C++17 | 375 ms | 9224 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 ll long long
#define F first
#define S second
#define pll pair<ll, ll>
#define v(a) vector<a>
int main(){
ll n; cin >> n;
map<ll, ll> x, y;
v(pll) arr(n);
for(int i = 0; i < n; i++){
cin >> arr[i].F >> arr[i].S;
x[arr[i].F]++; y[arr[i].S]++;
}
ll ans = 0;
for(int i = 0; i < n; i++){
ll xx = x[arr[i].F]-1, yy = y[arr[i].S]-1;
ans += (xx*yy);
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |