Submission #93819

#TimeUsernameProblemLanguageResultExecution timeMemory
93819Noam527Star triangles (IZhO11_triangle)C++17
100 / 100
445 ms12408 KiB
#include <bits/stdc++.h> #define CHECK cout << "ok" << endl #define finish(x) return cout << x << endl, 0 typedef long long ll; typedef long double ldb; const int md = 1e9 + 7, inf = 1e9 + 7; using namespace std; void debug(string names) { cout << '\n'; } template<typename A1, typename... A2> void debug(string names, A1 par, A2... left) { int pos = 0; for (; pos < names.size() && names[pos] != ' ' && names[pos] != ','; pos++) cout << names[pos]; cout << ": " << par << " "; while (pos < names.size() && (names[pos] == ' ' || names[pos] == ',')) { pos++; } names.erase(names.begin(), names.begin() + pos); debug(names, left...); } int n; vector<pair<int, int>> a; map<int, int> x, y; ll ans = 0; int main() { ios::sync_with_stdio(0), cin.tie(0); cin >> n; a.resize(n); for (auto &i : a) cin >> i.first >> i.second, x[i.first]++, y[i.second]++; for (auto &i : a) ans += (ll)(x[i.first] - 1) * (y[i.second] - 1); finish(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...