Submission #493515

#TimeUsernameProblemLanguageResultExecution timeMemory
493515reniStar triangles (IZhO11_triangle)C++14
100 / 100
131 ms14172 KiB
#include<iostream> #include<unordered_map> #define endl '\n' using namespace std; unordered_map<long long, long long>mpx, mpy; long long a[300000][2]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long i,j,x,y,n, br=0; cin>>n; for(i=0;i<n;i++) { cin>>x>>y; a[i][0]=x; a[i][1]=y; mpx[x]++; mpy[y]++; } for(i=0;i<n;i++) { x=a[i][0]; y=a[i][1]; if(mpx.count(x) && mpy.count(y))br+=(mpx[x]-1)*(mpy[y]-1); } cout<<br<<endl; }

Compilation message (stderr)

triangle.cpp: In function 'int main()':
triangle.cpp:13:17: warning: unused variable 'j' [-Wunused-variable]
   13 |     long long i,j,x,y,n, br=0;
      |                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...