Submission #287645

#TimeUsernameProblemLanguageResultExecution timeMemory
287645fgojkoQuality Of Living (IOI10_quality)C++14
Compilation error
0 ms0 KiB
#include <iostream>
#include <vector>
#include <algorithm>

//#define FEEDBACK

using namespace std;

typedef unsigned long long ull;

int rectangle(int n, int m, int x, int y, int** mat){
    vector<ull> vec;
    int max = n*m;
    for(int i = 0; i <= n-x; ++i){
        for(int j = 0; j <= m-y; ++j){
            vec.resize(0);
            for(int a = i; a < i+x; ++a){
                for(int b =j; b < j+y; ++b){
                    vec.push_back(mat[a][b]);
                }
            }
            sort(vec.begin(), vec.end());
#ifdef FEEDBACK
            cout << "( " << i << ", " << j << " )\n";
            cout << "median = " << vec[vec.size()/2] << endl;
#endif // FEEDBACK
            if(max > vec[vec.size()/2]){
                max = vec[vec.size()/2];
            }
        }
    }
    return max;
}

Compilation message (stderr)

quality.cpp: In function 'int rectangle(int, int, int, int, int**)':
quality.cpp:27:20: warning: comparison of integer expressions of different signedness: 'int' and '__gnu_cxx::__alloc_traits<std::allocator<long long unsigned int>, long long unsigned int>::value_type' {aka 'long long unsigned int'} [-Wsign-compare]
   27 |             if(max > vec[vec.size()/2]){
/tmp/ccXJIpYI.o: In function `main':
grader.cpp:(.text.startup+0xcd): undefined reference to `rectangle(int, int, int, int, int (*) [3001])'
collect2: error: ld returned 1 exit status