在一个 n 行 m 列的网格上,初始所有灯泡都是熄灭的(状态为 0)。坐标从 (1,1) 到 (n,m)。
现在进行 k 次操作,操作类型如下:
c x y:将坐标为 (x,y) 的灯泡点亮(状态变为 1)。l x y:从 (x,y) 出发向左(同一行,y 减小方向)查找最近的熄灭灯泡,不包含 (x,y) 本身。若存在,输出其坐标;否则输出 -1。r x y:向右查找。u x y:向上查找。d x y:向下查找。
By signing up a CodeFun2000 universal account, you can submit code and join discussions in all online judging services provided by us.