답안 #86994

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86994 2018-11-29T05:38:13 Z rakuten 별들과 삼각형 (IZhO11_triangle) C++14
0 / 100
2 ms 508 KB
#include <bits/stdc++.h>

#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define int long long
#define OK puts("OK")
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 2e5+10;
const int inf = 1e9+7;
int n , l ,r;
pair < int,int > a[N];
int ans = 0;
int x [N] , y [N] ;

 main(){

	cin >> n;
	for(int i = 1 ; i <= n ; i++ )
    {
		cin >> a[i].fr >> a[i].sc;
		x[a[i].fr] ++;
		y[a[i].sc] ++;
	}

	for(int i = 1 ; i <= n ; i++ )
    {
		l = x[a[i].fr] -1 ;
		r = y[a[i].sc] -1 ;
		ans += l*r ;
	}

	cout << ans << endl;
}

Compilation message

triangle.cpp:21:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  main(){
       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Incorrect 2 ms 508 KB Output isn't correct
6 Halted 0 ms 0 KB -