Submission #920312

#TimeUsernameProblemLanguageResultExecution timeMemory
920312zeta7532Star triangles (IZhO11_triangle)C++17
100 / 100
279 ms18008 KiB
#include <bits/stdc++.h> #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; using ll = long long; const ll mod = 998244353; #define fi first #define se second #define rep(i,n) for(ll i=0;i<n;i++) #define all(x) x.begin(),x.end() #define faster ios::sync_with_stdio(false);cin.tie(nullptr) int main() { ll N; cin >> N; vector<ll> X(N),Y(N); rep(i,N) cin >> X[i] >> Y[i]; vector<ll> x=X,y=Y; sort(all(x)); x.erase(unique(all(x)),x.end()); sort(all(y)); y.erase(unique(all(y)),y.end()); rep(i,N) X[i]=lower_bound(all(x),X[i])-x.begin(); rep(i,N) Y[i]=lower_bound(all(y),Y[i])-y.begin(); vector<ll> cntX(300500,0),cntY(300500,0); rep(i,N) cntX[X[i]]++; rep(i,N) cntY[Y[i]]++; ll ans=0; rep(i,N){ ans+=(cntX[X[i]]-1)*(cntY[Y[i]]-1); } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...