Submission #514822

#TimeUsernameProblemLanguageResultExecution timeMemory
514822Be_dosStar triangles (IZhO11_triangle)C++17
100 / 100
588 ms12120 KiB
#include <iostream> #include <cmath> #include <cctype> #include <vector> #include <algorithm> #include <set> #include <map> #include <deque> #include <stack> #include <unordered_set> #include <sstream> #include <cstring> #include <iomanip> #include <queue> #include <unordered_map> #include <random> #include <cfloat> #include <chrono> #include <bitset> #include <complex> #include <immintrin.h> #include <cassert> int main() { int32_t n; std::cin >> n; std::map<int32_t, int32_t> per_x, per_y; std::pair<int32_t, int32_t>* points = new std::pair<int32_t, int32_t>[n]; for(int32_t i = 0; i < n; i++) { int32_t x, y; std::cin >> x >> y; per_x[x]++; per_y[y]++; points[i] = {x, y}; } int64_t ans = 0; for(int32_t i = 0; i < n; i++) ans += (int64_t)(per_x[points[i].first] - 1) * (per_y[points[i].second] - 1); std::cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...