# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
671664 | ReLice | Star triangles (IZhO11_triangle) | C++14 | 305 ms | 12668 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 endl "\n"
#define ll long long
#define ld long double
#define pb push_back
#define sz size()
#define fr first
#define sc second
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
void start(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
const ll mod=998244353;
const ll inf=1e18;
const ll N=1e5+10;
void solve(){
ll n,i,mx=-1,mn=inf,x,y;
cin>>n;
vector <pair<ll,ll>> v;
map<ll,ll> mpx,mpy;
for(i=0;i<n;i++){
cin>>x>>y;
mpx[x]++;
mpy[y]++;
v.pb({x,y});
}
ll ans=0;
for(auto i : v){
ans+=((mpx[i.fr]-1)*(mpy[i.sc]-1));
}
cout<<ans<<endl;
}
signed main(){
// fre("divide");
start();
ll t=1;
//cin>>t;
while(t--) solve();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |