# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
944473 | Zena_Hossam | Star triangles (IZhO11_triangle) | C++14 | 751 ms | 37492 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 fi ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll double
#define ll long long
//#define ll1 long long
#define F first
#define S second
#define sz size()
#define all(s) s.begin(),s.end()
#define all1(s) s.rbegin(),s.rend()
int main()
{
// freopen("measurement.in","r",stdin);freopen("measurement.out","w",stdout);
ll T=1;
//cin>>T;ll oo=0;
while(T--)
{
ll n;
cin>>n;
pair<ll,ll>a[n];map<ll,map<ll,ll>>m;
map<ll,ll>x,b;
for(ll i=0;i<n;i++){
cin>>a[i].first>>a[i].second;x[a[i].F]++;b[a[i].S]++;
m[a[i].first][a[i].second]++;
}ll c=0;
for(ll i=0;i<n;i++){ll g=a[i].first,h=a[i].second;
c+=(x[g]-1)*(b[h]-1)-(m[g][h]-1);
}cout<<c;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |