# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
421955 | sikamax2019 | Star triangles (IZhO11_triangle) | C++14 | 168 ms | 14244 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>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define ll long long
#define ld long double
#define fs first
#define sc second
#define debug(x) cout << '[' << #x << " is: " << x << "] " << endl;
#define sz(x) (int)(x).size()
#define int long long
#define all(x) x.begin(), x.end()
int gcd(int a,int b){
return b==0?a:gcd(b,a%b);
}
int lcm(int a,int b){
return a*b/gcd(a,b);
}
const int mod =1e9+7;
const ll N = 3e5 + 9;
unordered_map<ll,ll> mpx,mpy;
int n,ans;
pair<int ,int >a[N];
int32_t main() {
IOS;
int n;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i].fs>>a[i].sc;
mpx[a[i].fs]++;
mpy[a[i].sc]++;
}
int ans=0;
for (int i = 1;i <= n;i++){
int p = mpx[a[i].fs] - 1,q = mpy[a[i].sc] - 1;
ans+=p*q;
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |