Submission #293864

#TimeUsernameProblemLanguageResultExecution timeMemory
2938647_7_7Star triangles (IZhO11_triangle)C++17
100 / 100
510 ms12408 KiB
#include <bits/stdc++.h> using namespace std; int n; map<int, int> x; map<int, int> y; int main() { ios_base::sync_with_stdio(false); cin >> n; vector<int> a(n + 1), b(n + 1); for(int i = 1; i <= n; i ++){ cin >> a[i] >> b[i]; x[a[i]] ++; y[b[i]] ++; } long long res = 0; for(int i = 1; i <= n; i ++){ x[a[i]] --; y[b[i]] --; res += (x[a[i]] * 1ll * y[b[i]]); x[a[i]] ++; y[b[i]] ++; } cout << res << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...