# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
977105 | vjudge1 | Star triangles (IZhO11_triangle) | C++17 | 262 ms | 10424 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>
#pragma GCC optimize("Ofast")
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define nl "\n"
#define ll long long
#define str string
#define dl double
#define ts(val) to_string(val)
#define ti(val) stoi(val)
#define ft first
#define sc second
#define Pb push_back
#define pB pop_back
#define mp make_pair
#define mst(array,value) memset(array,value,sizeof(array))
#define gtr greater<int>()
#define all(ar) ar.begin(),ar.end()
using namespace std;
#define ull unsigned long long int
map<int, ll> cntX, cntY;
int main() {
fast;
int n; cin >> n;
vector<pair<int, int>> xy;
for(int i=0;i<n;i++) {
int x, y; cin >> x >> y;
xy.Pb(mp(x,y));
cntX[x]++;
cntY[y]++;
}
ll ans=0;
for(auto it:xy) {
ans += ((cntX[it.ft]-1) * (cntY[it.sc]-1));
}
cout << ans << nl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |