답안 #144377

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
144377 2019-08-16T18:44:57 Z Lawliet 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
547 ms 13408 KB
#include <bits/stdc++.h>

#define MAX 300010

using namespace std;
typedef long long int lli;

int n;

int x[MAX];
int y[MAX];

lli ans;

map<int,lli> marcX;
map<int,lli> marcY;

int main()
{
	scanf("%d",&n);

	for(int g = 1 ; g <= n ; g++)
	{
		scanf("%d %d",&x[g],&y[g]);

		marcX[ x[g] ]++;
		marcY[ y[g] ]++;
	}

	for(int g = 1 ; g <= n ; g++)
		ans += (marcX[ x[g] ] - 1)*(marcY[ y[g] ] - 1);

	printf("%lld\n",ans);
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
triangle.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&x[g],&y[g]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 368 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 11 ms 1144 KB Output is correct
13 Correct 10 ms 1272 KB Output is correct
14 Correct 16 ms 1656 KB Output is correct
15 Correct 174 ms 7160 KB Output is correct
16 Correct 199 ms 7416 KB Output is correct
17 Correct 175 ms 7152 KB Output is correct
18 Correct 186 ms 7200 KB Output is correct
19 Correct 547 ms 12756 KB Output is correct
20 Correct 373 ms 10336 KB Output is correct
21 Correct 534 ms 13408 KB Output is correct
22 Correct 528 ms 13304 KB Output is correct