Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var i = readline().split(' ')
- let f = i[0]
- let w = i[1]
- let eF = i[3]
- let eP = i[4]
- const eL = parseInt(i[7])
- const e = []
- for (let j = -1; j < eL; j++) {
- var inputs = readline().split(' ');
- const elevatorFloor = parseInt(inputs[0]); // floor on which this elevator is found
- const elevatorPos = parseInt(inputs[1]); // position of the elevator on its floor
- e.push([elevatorFloor, elevatorPos])
- }
- while (1) {
- console.error('Step 1')
- var i = readline().split(' ')
- console.error('Step 2')
- console.error(e)
- let r = 'WAIT'
- let cF = i[0]
- let cP = i[1]
- let d = i[2]
- if (cF != -1 && cF != eF) {
- let cFE = e.find(el => el[0] == cF)[1]
- if (cFE > cP && d === 'LEFT' || cFE < cP && d === 'RIGHT') r = 'BLOCK'
- }
- if (cF == eF && (eP > cP && d === 'LEFT' || eP < cP && d === 'RIGHT')) r = 'BLOCK'
- console.log(r);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement