1476.cpp (452B)
1 class SubrectangleQueries { 2 vector<vector<int>> &rectangle; 3 4 public: 5 SubrectangleQueries(vector<vector<int>> &rectangle) : rectangle(rectangle) {} 6 void updateSubrectangle(int row1, int col1, int row2, int col2, int newValue) { 7 for (int i = row1; i <= row2; i++) 8 for (int j = col1; j <= col2; j++) 9 rectangle[i][j] = newValue; 10 } 11 12 int getValue(int row, int col) { return rectangle[row][col]; } 13 };