Those are much clearer questions!
CAN the IR sensor detect different colors?
No. It may be able to detect different shades of color, though.
Will 5 IR sensors be enough?
Probably. You'd probably want one in the middle, and make sure that stays "detecting" all the time, and use the others to detect going off-track.
solve the grid
You will probably have to number the grid intersection points in a coordinate system. Make the start corner 0,0 and go X horizontally and Y vertically, for example. The robot will then have to remember which direction it's going on (along + or - X, or along + or - Y) and increment/decrement the coordinate it's at when it detects an intersection. The robot should then be able to navigate to any given coordinate by counting intersections and turning appropriately.
detecting obstacles
You need different sensors for this. Limit switches with long blades (a k a "bumper switches") are possibly a good choice. You might need some kind of input to tell whether a cube is black or white, though.
pick up cubes
You need some kind of gripper, and some kind of lifter, at a minimum. And, ideally, space for three cubes, so you don't have to run back and forth between cubes and destinations, but can instead just grab them all as you find them (if that's an acceptable strategy for the problem.) This sounds pretty hairy, mechanically; if you have a week to build it, you might be in trouble! Buying a ready-made servo gripper arm might help.
Also, regarding detecting colors and obstacles: There exist color detector sensors, that work on very near-field distances (a centimeter, perhaps.) This might be an option. You probably also want a white LED to illuminate where you're going for the detector to work right. Or you can use a webcam, assuming you're using a high-performance single-board computer, such as a Raspberry Pi, or a BeagleBone.