# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
609286 | mannshah1211 | Star triangles (IZhO11_triangle) | C++14 | 388 ms | 14164 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;
typedef long long ll;
int main(){
ll n;
cin >> n;
ll x[n];
ll y[n];
for(ll i = 0; i < n; i++){
cin >> x[i] >> y[i];
}
unordered_map <ll, ll> freqX;
unordered_map <ll, ll> freqY;
ll ans = 0;
for(ll i : x){
freqX[i] = 0;
}
for(ll i : y){
freqY[i] = 0;
}
for(ll i : x){
freqX[i]++;
}
for(ll i : y){
freqY[i]++;
}
for(ll i = 0; i < n; i++){
ans += (freqX[x[i]] - 1)*(freqY[y[i]] - 1);
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |