# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
531775 | makanhulia | Star triangles (IZhO11_triangle) | C++17 | 578 ms | 6872 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;
using ll = long long;
int main(){
int n; cin >> n;
pair<int, int>pii[n];
map<int, ll>cntX, cntY;
for(int i = 0; i < n; i++){
auto &[x, y] = pii[i];
cin >> x >> y;
cntX[x]++;
cntY[y]++;
}
ll ans = 0;
for(int i = 0; i < n; i++){
auto &[x, y] = pii[i];
ans += max(0LL, (cntX[x] - 1)*(cntY[y] - 1));
}
cout << ans << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |