Submission #977008

#TimeUsernameProblemLanguageResultExecution timeMemory
977008vjudge1Star triangles (IZhO11_triangle)C++17
100 / 100
1270 ms48464 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define fs first #define sc second int main(){ int n; cin>>n; multiset<pair<int,int>> p; multiset<int> mx,my; while (n--) { int x,y; cin>>x>>y; p.insert({x,y}); mx.insert(x);my.insert(y); } ll cnt=0; for (auto [x,y]:p){ ll a=mx.count(x)-p.count({x,y}),b=my.count(y)-p.count({x,y}); cnt+=a*b; } cout<<cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...