Submission #1122951

#TimeUsernameProblemLanguageResultExecution timeMemory
1122951marinalucaStar triangles (IZhO11_triangle)C++20
100 / 100
295 ms9240 KiB
#include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC optimize ("fast-math") #pragma GCC optimize ("unroll-loops") using namespace std; #define int long long #define ll long long #define all (x) begin(x), end (x) #define xx first #define yy second using pii = pair <int, int>; using tii = tuple <int, int, int>; int n; constexpr int NMAX = (int) 3e5; int v[NMAX + 1], w[NMAX + 1]; map <int, int> frec, frec1; int s; signed main(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n; for (int i = 1; i <= n; ++ i) { cin >> v[i] >> w[i]; frec[v[i]] ++; frec1[w[i]] ++; } for (int i = 1; i <= n; ++ i) { s += (frec[v[i]] - 1) * (frec1[w[i]] - 1); } cout << s; return 0 ^ 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...