Submission #168100

#TimeUsernameProblemLanguageResultExecution timeMemory
168100GioChkhaidzeStar triangles (IZhO11_triangle)C++14
100 / 100
529 ms15608 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; const int N=3e5+5; ll n,x[N],y[N],ans; map < ll , ll > f1,f2; main () { scanf("%d",&n); for (int i=1; i<=n; i++) { scanf("%d%d",&x[i],&y[i]); f1[x[i]]++,f2[y[i]]++; } for (int i=1; i<=n; i++) ans+=(f1[x[i]]-1)*(f2[y[i]]-1); printf("%lld\n",ans); }

Compilation message (stderr)

triangle.cpp:7:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
triangle.cpp: In function 'int main()':
triangle.cpp:8:15: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
  scanf("%d",&n);
             ~~^
triangle.cpp:10:27: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   scanf("%d%d",&x[i],&y[i]);
                ~~~~~      ^
triangle.cpp:10:27: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
triangle.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
triangle.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&x[i],&y[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...