[i][0]번째 인덱스에는 가로세로중 큰값, [i][1]번째 인덱스에는 가로세로중 작은값으로 변경하여 저장하여준다음
각각 열중 가장 큰값들의 곱을 리턴해 주면 되는 간단한 문제이다.
#include <string>
#include <vector>
using namespace std;
int solution(vector<vector<int>> sizes)
{
int row=0, col= 0, n = sizes.size();
for (int i=0;i<n;i++)
if (sizes[i][0] < sizes[i][1]) swap(sizes[i][0], sizes[i][1]);
// 배열의 두값을 변경해주는 함수이다. iterator로 접근하면 iter_swap을 사용하면 된다.
for (int i=0;i<n;i++)
{
row = max(row, sizes[i][0]);//각각
col = max(col, sizes[i][1]);//큰값 저장
}
return row * col ;
}