Submission #547819

#TimeUsernameProblemLanguageResultExecution timeMemory
547819racsosabeStar triangles (IZhO11_triangle)C++14
100 / 100
309 ms13344 KiB
#include <bits/stdc++.h> using namespace std; int n; map<int, int> X; map<int, int> Y; int main(){ scanf("%d", &n); vector<pair<int, int>> v; for(int i = 0; i < n; i++){ int x, y; scanf("%d %d", &x, &y); X[x]++; Y[y]++; v.emplace_back(make_pair(x, y)); } long long ans = 0; for(auto e : v){ ans += 1ll * (X[e.first] - 1) * (Y[e.second] - 1); } printf("%lld\n", ans); return 0; }

Compilation message (stderr)

triangle.cpp: In function 'int main()':
triangle.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
triangle.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d %d", &x, &y);
      |   ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...