답안 #87938

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
87938 2018-12-03T09:21:22 Z turbat 별들과 삼각형 (IZhO11_triangle) C++14
0 / 100
3 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
int n;
long long ans;
pair <int, int> p[300005];
map <int, int> my, mx;

int main (){
	freopen ("input.in", "r", stdin);
	freopen ("output.out", "w", stdout);	
	cin >> n;
	for (int i = 0;i < n;i++){
		cin >> p[i].F>> p[i].S;
		mx[p[i].F]++;
		my[p[i].S]++;
	}
	for (int i = 0;i < n;i++)
		ans += (mx[p[i].F] - 1) * (my[p[i].S] - 1);
	cout << ans<<endl;
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:11:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen ("input.in", "r", stdin);
  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
triangle.cpp:12:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen ("output.out", "w", stdout); 
  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -