Submission #920821

#TimeUsernameProblemLanguageResultExecution timeMemory
920821MtSakaStar triangles (IZhO11_triangle)C++17
100 / 100
375 ms16464 KiB
#include"bits/stdc++.h" #define overload(a,b,c,d,...) d #define rep1(a) for(ll _=0;_<(ll)a;++_) #define rep2(i,n) for(ll i=0;i<(ll)n;++i) #define rep3(i,l,r) for(ll i=(ll)l;i<(ll)r;++i) #define rep(...) overload(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__) #define rrep1(i,a) for(ll i=(ll)a-1;i>=0;--i) #define rrep2(i,a,b) for(ll i=(ll)b-1;i>=(ll)a;--i) #define rrep(...) overload(__VA_ARGS__,rrep2,rrep1)(__VA_ARGS__) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define pb push_back #define eb emplace_back using namespace std; using ll=long long; using ull=unsigned long long; using ld=long double; template<typename T,typename U>inline bool chmin(T&a,const U&b){return (a>b?a=b,true:false);} template<typename T,typename U>inline bool chmax(T&a,const U&b){return (a<b?a=b,true:false);} static constexpr ll mod1=998244353; static constexpr ll mod=1000000007; static constexpr ll inf=numeric_limits<ll>::max()/2; int main(){ ll n;cin>>n; map<ll,ll>cntx; map<ll,vector<ll>>ys; rep(i,n){ ll a,b;cin>>a>>b; cntx[a]++; ys[b].eb(a); } ll ans=0; for(auto [y,v]:ys){ ll tmp=v.size()-1; for(auto x:v)ans+=tmp*(cntx[x]-1); } cout<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...