Submission #144377

#TimeUsernameProblemLanguageResultExecution timeMemory
144377LawlietStar triangles (IZhO11_triangle)C++14
100 / 100
547 ms13408 KiB
#include <bits/stdc++.h>

#define MAX 300010

using namespace std;
typedef long long int lli;

int n;

int x[MAX];
int y[MAX];

lli ans;

map<int,lli> marcX;
map<int,lli> marcY;

int main()
{
	scanf("%d",&n);

	for(int g = 1 ; g <= n ; g++)
	{
		scanf("%d %d",&x[g],&y[g]);

		marcX[ x[g] ]++;
		marcY[ y[g] ]++;
	}

	for(int g = 1 ; g <= n ; g++)
		ans += (marcX[ x[g] ] - 1)*(marcY[ y[g] ] - 1);

	printf("%lld\n",ans);
}

Compilation message (stderr)

triangle.cpp: In function 'int main()':
triangle.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
triangle.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&x[g],&y[g]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...