forked from mpfeifer1/Kattis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpachydermpeanutpacking.cpp
63 lines (51 loc) · 1.25 KB
/
pachydermpeanutpacking.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <iostream>
#include <vector>
using namespace std;
struct box {
double x1, y1, x2, y2;
string size;
};
bool inbox(box b, double x, double y) {
return (b.x1 <= x && x <= b.x2 && b.y1 <= y && y <= b.y2);
}
int main() {
int n;
bool first = true;
while(cin >> n && n != 0) {
if(first) {
first = false;
}
else {
cout << endl;
}
vector<box> boxes;
for(int i = 0; i < n; i++) {
box b;
cin >> b.x1 >> b.y1 >> b.x2 >> b.y2 >> b.size;
boxes.push_back(b);
}
int p;
cin >> p;
for(int i = 0; i < p; i++) {
double x, y;
string size;
cin >> x >> y >> size;
cout << size << " ";
bool printed = false;
for(auto b : boxes) {
if(inbox(b, x, y)) {
printed = true;
if(b.size == size) {
cout << "correct" << endl;
}
else {
cout << b.size << endl;
}
}
}
if(!printed) {
cout << "floor" << endl;
}
}
}
}