Submission #707034

#TimeUsernameProblemLanguageResultExecution timeMemory
707034ToroTNStar triangles (IZhO11_triangle)C++14
100 / 100
586 ms32204 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define X first #define Y second #define mpr make_pair ll n,x[300005],y[30005],cnt=0,num,xx,yy; map<ll,ll> mp1,mp2; map<pair<ll,ll>,ll> mp; map<pair<ll,ll>,ll> :: iterator it; int main() { scanf("%lld",&n); for(int i=1;i<=n;i++) { scanf("%lld%lld",&x[i],&y[i]); ++mp1[x[i]],++mp2[y[i]]; ++mp[mpr(x[i],y[i])]; } for(it=mp.begin();it!=mp.end();it++) { num=(*it).Y; xx=(*it).X.X; yy=(*it).X.Y; cnt+=(mp1[xx]-num)*(mp2[yy]-num)*num; } printf("%lld\n",cnt); }

Compilation message (stderr)

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