Submission #671619

#TimeUsernameProblemLanguageResultExecution timeMemory
671619smartmonkyStar triangles (IZhO11_triangle)C++14
100 / 100
277 ms9084 KiB
#include <bits/stdc++.h>
  
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define int long long
using namespace std;
 
int n;
map <int,int> x, y;
main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	vector <pair <int,int> > vp(n);
	for(int i = 0; i < n; i++){
		cin >> vp[i].ff >> vp[i].ss;
		x[vp[i].ff]++;
		y[vp[i].ss]++;
	}
	int ans = 0;
	for(auto f : vp){
		ans += (x[f.ff] - 1) * (y[f.ss] - 1);
	}
	cout << ans;
}

Compilation message (stderr)

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