// // Created by cteam31 on 10/21/23. // #include #include #include #include using namespace std; class Room { public: Room() :desks(0), monitors(0), availableRooms() { } int desks; int monitors; vector availableRooms; }; void check(const vector & rooms, int which) { int numberOfMonitors = rooms[which].monitors; int numberOfDesks = rooms[which].desks; for(const auto & i : rooms[which].availableRooms){ numberOfMonitors += rooms[i].monitors; numberOfDesks += rooms[i].desks; } if(numberOfMonitors > numberOfDesks) { cout << "monitors" << endl; } else if(numberOfMonitors < numberOfDesks) { cout << "desks" << endl; } else { cout << "same" << endl; } } int main() { int numberOfLabs; int numberOfPairLabs; int numberOfQueries; int actual = 0; cin >> numberOfLabs >> numberOfPairLabs >> numberOfQueries; vector rooms(numberOfLabs); for(int i = 0; i < numberOfLabs; i++){ cin >> rooms[i].desks; } for(int i = 0; i < numberOfLabs; i++){ cin >> rooms[i].monitors; } for(int i = 0; i < numberOfPairLabs; i++){ int a = 0 ,b = 0; cin >> a >> b; rooms[a-1].availableRooms.push_back(b-1); rooms[b-1].availableRooms.push_back(a-1); } while(cin.good() || !cin.eof()) { if(actual >= numberOfQueries){ return 0; } actual++; string query; cin >> query; cin.clear(); if(query == "add"){ int numero = 0, where = 0; string what; cin >> numero; cin >> what; cin >> where; if(what == "desk"){ rooms[where-1].desks+=numero; } else { rooms[where-1].monitors+=numero; } } else { int numero = 0; cin >> numero; check(rooms, numero-1); } } return 0; }