Submission #977105

#TimeUsernameProblemLanguageResultExecution timeMemory
977105vjudge1Star triangles (IZhO11_triangle)C++17
100 / 100
262 ms10424 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define nl "\n" #define ll long long #define str string #define dl double #define ts(val) to_string(val) #define ti(val) stoi(val) #define ft first #define sc second #define Pb push_back #define pB pop_back #define mp make_pair #define mst(array,value) memset(array,value,sizeof(array)) #define gtr greater<int>() #define all(ar) ar.begin(),ar.end() using namespace std; #define ull unsigned long long int map<int, ll> cntX, cntY; int main() { fast; int n; cin >> n; vector<pair<int, int>> xy; for(int i=0;i<n;i++) { int x, y; cin >> x >> y; xy.Pb(mp(x,y)); cntX[x]++; cntY[y]++; } ll ans=0; for(auto it:xy) { ans += ((cntX[it.ft]-1) * (cntY[it.sc]-1)); } cout << ans << nl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...