# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
86997 | rakuten | Star triangles (IZhO11_triangle) | C++14 | 815 ms | 9468 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
#define pb push_back
#define mk make_pair
#define int long long
#define OK puts("OK")
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
using namespace std;
const int N = 3e5+10;
const int inf = 1e9+7;
int n , l ,r;
pair < int,int > a[N];
int ans = 0;
map < int , int > x , y ;
main(){
cin >> n;
for(int i = 1 ; i <= n ; i++ )
{
cin >> a[i].fr >> a[i].sc;
x[a[i].fr] ++ ;
y[a[i].sc] ++ ;
}
for(int i = 1 ; i <= n ; i++ )
{
l = x[a[i].fr] -1 ;
r = y[a[i].sc] -1 ;
ans += l*r ;
}
cout << ans << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |