Submission #497907

#TimeUsernameProblemLanguageResultExecution timeMemory
497907AktanStar triangles (IZhO11_triangle)C++14
0 / 100
1 ms204 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(){ ifstream fin("triangles.in"); ofstream fout("triangles.out"); int n,ans=0; fin >> n; for(int i=0;i<n;i++){ fin >> 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); } fout << 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...