I thought as we can reduce a given rectangle to a given size cube.I stored the minimum of the dimensions of given rectangle in a c++ set and the answer would be equal to size of the set. But I am getting wrong ans.
Please let me know if my approach is correct or any testcase to prove its wrong.(As I am getting wrong answer )
Here’s the code:
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d",&n);
int a,b;
set<int> s;
for(int i=0;i<n;i++){
scanf("%d%d",&a,&b);
s.insert(min(a,b));
}
printf("%d\n",s.size());
return 0;