Submission #46965

#TimeUsernameProblemLanguageResultExecution timeMemory
46965robertStar triangles (IZhO11_triangle)C++14
100 / 100
568 ms38900 KiB
#include <cstdio> #include <map> using namespace std; int main(){ int N; scanf("%d", &N); int x[300100], y[300100]; map<int, int> ctx, cty; for(int n=0; n<N; n++){ scanf("%d %d", &x[n], &y[n]); ctx[x[n]]++; cty[y[n]]++; } long long ans = 0; for(int n=0; n<N; n++){ ans += (ctx[x[n]]-1)*(cty[y[n]]-1); } printf("%lld\n", ans); return 0; }

Compilation message (stderr)

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