답안 #46965

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
46965 2018-04-25T13:45:16 Z robert 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
568 ms 38900 KB
#include <cstdio>
#include <map>

using namespace std;

int main(){
	int N; scanf("%d", &N);
	int x[300100], y[300100];
	map<int, int> ctx, cty;
	for(int n=0; n<N; n++){
		scanf("%d %d", &x[n], &y[n]);
		ctx[x[n]]++;
		cty[y[n]]++;
	}
	long long ans = 0;
	for(int n=0; n<N; n++){
		ans += (ctx[x[n]]-1)*(cty[y[n]]-1);
	}
	printf("%lld\n", ans);
	return 0;
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:7:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int N; scanf("%d", &N);
         ~~~~~^~~~~~~~~~
triangle.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &x[n], &y[n]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 428 KB Output is correct
3 Correct 2 ms 540 KB Output is correct
4 Correct 2 ms 560 KB Output is correct
5 Correct 2 ms 568 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 2 ms 780 KB Output is correct
8 Correct 2 ms 780 KB Output is correct
9 Correct 2 ms 780 KB Output is correct
10 Correct 2 ms 780 KB Output is correct
11 Correct 2 ms 780 KB Output is correct
12 Correct 10 ms 1468 KB Output is correct
13 Correct 11 ms 1572 KB Output is correct
14 Correct 16 ms 2300 KB Output is correct
15 Correct 181 ms 7124 KB Output is correct
16 Correct 203 ms 9580 KB Output is correct
17 Correct 175 ms 11764 KB Output is correct
18 Correct 179 ms 13824 KB Output is correct
19 Correct 473 ms 21332 KB Output is correct
20 Correct 361 ms 25172 KB Output is correct
21 Correct 568 ms 32376 KB Output is correct
22 Correct 532 ms 38900 KB Output is correct