Submission #338635

#TimeUsernameProblemLanguageResultExecution timeMemory
338635blueQuality Of Living (IOI10_quality)C++17
Compilation error
0 ms0 KiB
#include "quality.h" #include <vector> using namespace std; int quality(int R, int C, int H, int W, int Q[][]) { int res = 0; vector<int> temp; for(int i = H-1; i < R; i++) { for(int j = W-1; j < C; j++) { temp.clear(); for(int x = i-H+1; x <= i; x++) { for(int y = j-W+1; y <= j; y++) { temp.push_back(Q[x][y]); } } sort(temp.begin(), temp.end()); res = max(res, temp[temp.size()/2]); } } return res; }

Compilation message (stderr)

quality.cpp:5:45: error: declaration of 'Q' as multidimensional array must have bounds for all dimensions except the first
    5 | int quality(int R, int C, int H, int W, int Q[][])
      |                                             ^
quality.cpp: In function 'int quality(...)':
quality.cpp:10:17: error: 'H' was not declared in this scope
   10 |     for(int i = H-1; i < R; i++)
      |                 ^
quality.cpp:10:26: error: 'R' was not declared in this scope
   10 |     for(int i = H-1; i < R; i++)
      |                          ^
quality.cpp:12:21: error: 'W' was not declared in this scope
   12 |         for(int j = W-1; j < C; j++)
      |                     ^
quality.cpp:12:30: error: 'C' was not declared in this scope
   12 |         for(int j = W-1; j < C; j++)
      |                              ^
quality.cpp:19:36: error: 'Q' was not declared in this scope
   19 |                     temp.push_back(Q[x][y]);
      |                                    ^
quality.cpp:22:13: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |             sort(temp.begin(), temp.end());
      |             ^~~~
      |             short