제출 #595400

#제출 시각아이디문제언어결과실행 시간메모리
595400Zanite별들과 삼각형 (IZhO11_triangle)C++17
100 / 100
300 ms12192 KiB
// I am now here, but I have yet to prove that I am worthy of my place here.

#include <bits/stdc++.h>
using namespace std;

using pii	= pair<int, int>;
using ll	= long long;

#define fi	first
#define se	second

const int maxN	= 3e5 + 1;

int N;
pii points[maxN];
map<int, int> X, Y;

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= N; i++) {
		scanf("%d %d", &points[i].fi, &points[i].se);
		X[points[i].fi]++;
		Y[points[i].se]++;
	}

	ll ans = 0;
	for (int i = 1; i <= N; i++) {
		ans += 1ll * (X[points[i].fi]-1) * (Y[points[i].se]-1);
	}
	printf("%lld\n", ans);
}

컴파일 시 표준 에러 (stderr) 메시지

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