# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
87013 | Aydarov03 | Star triangles (IZhO11_triangle) | C++14 | 1053 ms | 25096 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>
#define fr first
#define sc second
using namespace std;
map<int , int> x , y;
map <pair<int,int> , bool> used;
vector < pair<int,int> > xy;
main()
{
int n , ans = 0;
cin >> n;
for(int i = 1; i <= n; i++)
{
int a , b;
scanf("%d%d" , &a , &b);
if( used.count( { a,b } ) )continue;
x[a]++;
y[b]++;
xy.push_back( {a , b} );
used[ {a,b} ] = 1;
}
for(int i = 0; i < xy.size(); i++)
{
if( y.count( xy[i].second ) )
ans += (x[ xy[i].first ]-1) * (y[ xy[i].second ] - 1) ;
}
cout << ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |