Submission #24402

#TimeUsernameProblemLanguageResultExecution timeMemory
24402ExtazyStar triangles (IZhO11_triangle)C++14
100 / 100
689 ms9156 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1<<19; int n; pair < int, int > a[N]; long long ans; map < int, int > cntx,cnty; int main() { int i; scanf("%d", &n); for(i=1;i<=n;i++) { scanf("%d %d", &a[i].first, &a[i].second); ++cntx[a[i].first]; ++cnty[a[i].second]; } for(i=1;i<=n;i++) { ans+=(cntx[a[i].first]-1)*(cnty[a[i].second]-1); } printf("%lld\n", ans); return 0; }

Compilation message (stderr)

triangle.cpp: In function 'int main()':
triangle.cpp:15:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
triangle.cpp:17:50: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &a[i].first, &a[i].second);
                                                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...