Submission #1175784

#TimeUsernameProblemLanguageResultExecution timeMemory
1175784jakrinQuality Of Living (IOI10_quality)C++20
Compilation error
0 ms0 KiB
int rectangle(int R, int C, int H, int W, vector<vector<int>>& Q) {
    int bestMedian = 1e9;
    for (int i = 0; i <= R - H; i++) {
        for (int j = 0; j <= C - W; j++) {
            vector<int> values;
            for (int x = 0; x < H; x++) {
                for (int y = 0; y < W; y++) {
                    values.push_back(Q[i + x][j + y]);
                }
            }
            sort(values.begin(), values.end());
            bestMedian = min(bestMedian, values[values.size() / 2]);
        }
    }
    return bestMedian;
}

Compilation message (stderr)

quality.cpp:1:50: error: 'vector' was not declared in this scope
    1 | int rectangle(int R, int C, int H, int W, vector<vector<int>>& Q) {
      |                                                  ^~~~~~
quality.cpp:1:50: error: 'vector' was not declared in this scope
quality.cpp:1:50: error: 'vector' was not declared in this scope
quality.cpp:1:50: error: 'vector' was not declared in this scope
quality.cpp:1:43: error: 'vector' has not been declared
    1 | int rectangle(int R, int C, int H, int W, vector<vector<int>>& Q) {
      |                                           ^~~~~~
quality.cpp:1:49: error: expected ',' or '...' before '<' token
    1 | int rectangle(int R, int C, int H, int W, vector<vector<int>>& Q) {
      |                                                 ^
quality.cpp: In function 'int rectangle(int, int, int, int, int)':
quality.cpp:5:13: error: 'vector' was not declared in this scope
    5 |             vector<int> values;
      |             ^~~~~~
quality.cpp:5:20: error: expected primary-expression before 'int'
    5 |             vector<int> values;
      |                    ^~~
quality.cpp:8:21: error: 'values' was not declared in this scope
    8 |                     values.push_back(Q[i + x][j + y]);
      |                     ^~~~~~
quality.cpp:8:38: error: 'Q' was not declared in this scope
    8 |                     values.push_back(Q[i + x][j + y]);
      |                                      ^
quality.cpp:11:18: error: 'values' was not declared in this scope
   11 |             sort(values.begin(), values.end());
      |                  ^~~~~~
quality.cpp:11:13: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |             sort(values.begin(), values.end());
      |             ^~~~
      |             short
quality.cpp:12:26: error: 'min' was not declared in this scope
   12 |             bestMedian = min(bestMedian, values[values.size() / 2]);
      |                          ^~~