답안 #38149

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
38149 2018-01-02T12:05:12 Z 14kg 별들과 삼각형 (IZhO11_triangle) C++11
100 / 100
679 ms 6552 KB
#include <stdio.h>
#include <map>

using namespace std;
int n;
pair<int, int> in[300001];
map<int, int> X, Y;

int main() {
	long long cnt = 0, t1, t2;

	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d %d", &in[i].first, &in[i].second);
		X[in[i].first]++, Y[in[i].second]++;
	}
	for (int i = 1; i <= n; i++) {
		t1 = X[in[i].first] - 1, t2 = Y[in[i].second] - 1;
		cnt += t1*t2;
	}
	printf("%d", cnt);
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:21:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
  printf("%d", cnt);
                  ^
triangle.cpp:12:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
triangle.cpp:14:46: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &in[i].first, &in[i].second);
                                              ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3516 KB Output is correct
2 Correct 0 ms 3516 KB Output is correct
3 Correct 0 ms 3516 KB Output is correct
4 Correct 0 ms 3516 KB Output is correct
5 Correct 0 ms 3516 KB Output is correct
6 Correct 0 ms 3516 KB Output is correct
7 Correct 0 ms 3516 KB Output is correct
8 Correct 0 ms 3516 KB Output is correct
9 Correct 0 ms 3516 KB Output is correct
10 Correct 0 ms 3516 KB Output is correct
11 Correct 0 ms 3516 KB Output is correct
12 Correct 6 ms 4044 KB Output is correct
13 Correct 9 ms 4044 KB Output is correct
14 Correct 13 ms 4308 KB Output is correct
15 Correct 229 ms 6420 KB Output is correct
16 Correct 219 ms 6552 KB Output is correct
17 Correct 236 ms 6420 KB Output is correct
18 Correct 199 ms 6420 KB Output is correct
19 Correct 629 ms 6552 KB Output is correct
20 Correct 433 ms 6552 KB Output is correct
21 Correct 636 ms 6552 KB Output is correct
22 Correct 679 ms 6552 KB Output is correct