Submission #166757

#TimeUsernameProblemLanguageResultExecution timeMemory
166757LightningStar triangles (IZhO11_triangle)C++14
100 / 100
561 ms9248 KiB
#include <iostream> #include <algorithm> #include <vector> #include <cmath> #include <set> #include <map> #include <iomanip> #include <stack> #include <queue> #include <deque> using namespace std; typedef long long ll; typedef pair <int, int> pii; #define sz(a) (int)a.size() #define all(a) a.begin(), a.end() #define pb push_back #define ppb pop_back #define mkp make_pair #define F first #define S second #define show(a) cerr << #a <<" -> "<< a <<"\n" #define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d)) #define foo(a, b, c ,d) for(int (a) = (b); (a) >= (c); (a) -= (d)) //#define int ll const int N = 4e5; const int INF = 1e9; int n, x[N], y[N]; ll ans; map <int, int> cntX, cntY; int main () { ios_base::sync_with_stdio(false); cin >> n; fo(i, 1, n, 1) { cin >> x[i] >> y[i]; ++cntX[x[i]]; ++cntY[y[i]]; } fo(i, 1, n, 1) { ans += 1ll * (cntX[x[i]] - 1) * (cntY[y[i]] - 1); } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...