Submission #320029

#TimeUsernameProblemLanguageResultExecution timeMemory
320029kingfran1907Star triangles (IZhO11_triangle)C++14
100 / 100
469 ms12260 KiB
#include <bits/stdc++.h>
#define X first
#define Y second

using namespace std;
typedef long long llint;

const int maxn = 3e5+10;
const int base = 31337;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int logo = 20;
const int off = 1 << logo;
const int treesiz = off << 1;

int n;
int x[maxn], y[maxn];
map<int, int> xs, ys;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d%d", x+i, y+i);
		xs[x[i]]++;
		ys[y[i]]++;
	}
	
	llint sol = 0;
	for (int i = 0; i < n; i++) {
		sol += (llint)(xs[x[i]] - 1) * (ys[y[i]] - 1);
	}
	printf("%lld\n", sol);
	return 0;
}

Compilation message (stderr)

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