Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- using namespace std;
- int main()
- {
- int N, M, K;
- //N по оси OX; M по оси OY; K количество окон
- int window[100][4];
- cin >> N >> M >> K;
- for (int i = 0; i < K; i++)
- {
- for (int j = 0; j < 4; j++)
- {
- cin >> window[i][j];
- }
- }
- for (int i = 0; i < K; i++)
- {
- if (window[i][1] > N)
- {
- cout << "broken";
- return 0;
- }
- if (window[i][3] > M)
- {
- cout << "broken";
- return 0;
- }
- }
- for (int i = 0; i < K; i++)
- {
- for (int j = 0; j < K; j++)
- {
- if ((window[i][0] < window[j][0] && window[j][0] < window[i][1]) || (window[i][0] < window[j][1] && window[j][1] < window[i][1]))
- {
- cout << "broken";
- return 0;
- }
- else if ((window[i][2] < window[j][2] && window[j][2] < window[i][3]) || (window[i][2] < window[j][3] && window[j][3] < window[i][3]))
- {
- cout << "broken";
- return 0;
- }
- else
- {
- cout << "correct";
- return 0;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement