#include <iterator>
class Render {
public:
vector<int> renderPixel(vector<int> screen, int x, int y) {
// write code here
int start_idx = x/8;
int end_idx = y/8;
int start_bit = 0xFF << (x%8) & 0xFF;
int end_bit = (1 << (y%8 +1 ) ) -1;
if(start_idx == end_idx){
screen[start_idx] |= start_bit & end_bit;
return screen;
}
screen[start_idx] |= start_bit ;
screen[end_idx] |= end_bit;
for(int i = start_idx+1 ; i <end_idx;++i){
screen[i] = 0xFF;
}
return screen;
}
};

京公网安备 11010502036488号