# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975180 | vjudge1 | Star triangles (IZhO11_triangle) | C++17 | 271 ms | 13788 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>
typedef long double ld;
#define int long long
#define TC int t; cin >> t; for(int _=1; _<=t; _++)
#define pii pair<int, int>
#define pb push_back
#define ffl fflush(stdout)
using namespace std;
signed main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n; cin >> n;
map<int, int> mapx, mapy;
vector<pii> res;
for(int i=0; i<n; i++){
int x, y; cin >> x >> y;
mapx[x]++;
mapy[y]++;
res.pb(make_pair(x, y));
}
int ans = 0;
for(int i=0; i<n; i++){
int x = res[i].first, y = res[i].second;
int cntx = mapx[x]-1;
int cnty = mapy[y]-1;
if(cntx>0 && cnty>0){
ans+=(cntx*cnty);
}
}
cout << ans;
//cout << (4*(99*99)) + 200;
//cout << 99*99;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |