답안 #675751

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
675751 2022-12-27T19:46:48 Z QwertyPi 별들과 삼각형 (IZhO11_triangle) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

struct point{
	int x, y;
};

vector<point> P;

map<int> X, Y;
int main(){
	int n; cin >> n;
	for(int i = 0; i < n; i++){
		int x, y; cin >> x >> y;
		P.push_back({x, y});
		X[x]++; Y[y]++;
	}
	int ans = 0;
	for(int i = 0; i < n; i++){
		ans += (X[P[i].x] - 1) * (Y[P[i].y] - 1);
	}
	cout << ans << endl;
}

Compilation message

triangle.cpp:11:8: error: wrong number of template arguments (1, should be at least 2)
   11 | map<int> X, Y;
      |        ^
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from triangle.cpp:1:
/usr/include/c++/10/bits/stl_map.h:100:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  100 |     class map
      |           ^~~
triangle.cpp: In function 'int main()':
triangle.cpp:17:4: error: invalid types 'int[int]' for array subscript
   17 |   X[x]++; Y[y]++;
      |    ^
triangle.cpp:17:12: error: invalid types 'int[int]' for array subscript
   17 |   X[x]++; Y[y]++;
      |            ^
triangle.cpp:21:12: error: invalid types 'int[int]' for array subscript
   21 |   ans += (X[P[i].x] - 1) * (Y[P[i].y] - 1);
      |            ^
triangle.cpp:21:30: error: invalid types 'int[int]' for array subscript
   21 |   ans += (X[P[i].x] - 1) * (Y[P[i].y] - 1);
      |                              ^