# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1278869 | SmuggingSpun | Star triangles (IZhO11_triangle) | C++20 | 617 ms | 22300 KiB |
#include<bits/stdc++.h>
#define taskname "A"
using namespace std;
typedef long long ll;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if(fopen(taskname".inp", "r")){
freopen(taskname".inp", "r", stdin);
}
int n;
cin >> n;
map<pair<int, int>, int>point;
map<int, int>X, Y;
for(int i = 0; i < n; i++){
int x, y;
cin >> x >> y;
X[x]++;
Y[y]++;
point[make_pair(x, y)]++;
}
ll ans = 0;
for(map<pair<int, int>, int>::iterator it = point.begin(); it != point.end(); it++){
ans += 1LL * (X[(it->first).first] - it->second) * (Y[(it->first).second] - it->second) * it->second;
}
cout << ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |