# D3C - White Sheet Wrong Answer on Case 11

Problem Statement: Problem - C - Codeforces
I thought of a plausible approach to this problem: find the intersection between the white sheet and the first black sheet, let’s say wb1; find the intersection between the white sheet and the second black sheet, let’s say wb2, find intersection(intersection(b1, b2), w).

I implemented the code as follows:

``````#include <iostream>
#include <vector>
using namespace std;

int intersection(vector<int> v1, vector<int> v2) {
int minx = max(v1[0], v2[0]);
int maxx = min(v1[2], v2[2]);
int miny = max(v1[1], v2[1]);
int maxy = min(v1[3], v2[3]);

if (maxx-minx > 0 && maxy-miny > 0) {
return (maxx-minx)*(maxy-miny);
}
else {
return 0;
}
}

int main() {
vector<int> w(4);
vector<int> b1(4);
vector<int> b2(4);

for (int i=0; i<4; i++) {
cin >> w[i];
}
for (int i=0; i<4; i++) {
cin >> b1[i];
}
for (int i=0; i<4; i++) {
cin >> b2[i];
}

vector<int> b1b2(4);
b1b2[0] = max(b1[0], b2[0]);
b1b2[1] = min(b1[2], b2[2]);
b1b2[2] = max(b1[1], b2[1]);
b1b2[3] = min(b1[3], b2[3]);

if (intersection(w, b1)+intersection(w, b2)-intersection(w, b1b2) == (w[2]-w[0])*(w[3]-w[1])) {
cout << "NO" << endl;
}
else {
cout << "YES" << endl;
}

return 0;
}

``````

The code ran smoothly until it had a wrong answer on test case 11, and I cannot figure out why. Are there any edge cases that I did not consider?

You can view the test cases by clicking on your submission link.