Submission #497909

#TimeUsernameProblemLanguageResultExecution timeMemory
497909AktanStar triangles (IZhO11_triangle)C++14
100 / 100
955 ms34404 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #define int long long #define ft first #define sc second using namespace std; const int mod=1e9+7,INF=1e17; int a[300005],b[300005]; multiset<pair<int,int>> p; map<int,int> m,m1; main(){ int n,ans=0; cin >> n; for(int i=0;i<n;i++){ cin >> a[i] >> b[i]; p.insert({a[i],b[i]}); m[a[i]]++; m1[b[i]]++; } for(auto x : p){ ans+=(m[x.ft]-1)*(m1[x.sc]-1); } cout << ans; }

Compilation message (stderr)

triangle.cpp:15:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 |  main(){
      |  ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...