Submission #914942

#TimeUsernameProblemLanguageResultExecution timeMemory
914942adaawfStar triangles (IZhO11_triangle)C++14
100 / 100
246 ms12600 KiB
#include <iostream> #include <map> using namespace std; int a[300005], b[300005]; map<int, int> ma, mb; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i] >> b[i]; ma[a[i]]++; mb[b[i]]++; } long long int res = 0; for (int i = 1; i <= n; i++) { res += 1ll * (ma[a[i]] - 1) * (mb[b[i]] - 1); } cout << res; }
#Verdict Execution timeMemoryGrader output
Fetching results...