답안 #595400

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
595400 2022-07-13T17:18:46 Z Zanite 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
300 ms 12192 KB
// 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);
}

Compilation message

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);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 320 KB Output is correct
12 Correct 7 ms 980 KB Output is correct
13 Correct 7 ms 980 KB Output is correct
14 Correct 9 ms 1364 KB Output is correct
15 Correct 99 ms 6100 KB Output is correct
16 Correct 109 ms 6348 KB Output is correct
17 Correct 97 ms 6148 KB Output is correct
18 Correct 96 ms 6080 KB Output is correct
19 Correct 270 ms 11596 KB Output is correct
20 Correct 188 ms 9164 KB Output is correct
21 Correct 274 ms 12152 KB Output is correct
22 Correct 300 ms 12192 KB Output is correct