Submission #20815

#TimeUsernameProblemLanguageResultExecution timeMemory
20815jjwdi0Star triangles (IZhO11_triangle)C++11
100 / 100
1293 ms36344 KiB
#include <bits/stdc++.h> #define sz(x) ((int)(x).size()) using namespace std; map<int, set<int>> s1, s2; int N; long long ans; int main() { scanf("%d", &N); for(int i=0, x, y; i<N; i++) { scanf("%d %d", &x, &y); s1[x].insert(y); s2[y].insert(x); } for(auto itr : s1) { int i = itr.first; if(sz(s1[i]) >= 2) { for(auto it : s1[i]) { ans += (long long)(sz(s1[i]) - 1) * (sz(s2[it]) - 1); } } } printf("%lld", ans); }

Compilation message (stderr)

triangle.cpp: In function 'int main()':
triangle.cpp:10:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
                 ^
triangle.cpp:12:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &x, &y);
                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...