Submission #755032

#TimeUsernameProblemLanguageResultExecution timeMemory
755032UnforgettableplQuality Of Living (IOI10_quality)C++17
Compilation error
0 ms0 KiB
/*
ID: samikgo1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define f first
#define s second
//#define x first
//#define y second
const int INF = INT32_MAX;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("haybales.in","r",stdin);
//    freopen("haybales.out","w",stdout);
    ll r,c,h,w;
    cin >> r >> c >> h >> w;
    vector<vector<ll>> grid(r,vector<ll>(c));
    for(auto&i:grid)for(ll&j:i)cin>>j;
    ll ans = INFINITY;
    for (int i = 0; i < r-h; i++) {
        for (int j = 0; j < c-w; j++) {
            vector<ll> quality;
            for (int k = i; k < i+h; k++) {
                for (int l = j; l < j+h; l++) {
                    quality.emplace_back(grid[k][l]);
                }
            }
            ans = min(ans,quality[quality.size()>>1]);
        }
    }
    cout << ans;
}

Compilation message (stderr)

quality.cpp: In function 'int main()':
quality.cpp:27:14: warning: overflow in conversion from 'float' to 'll' {aka 'long long int'} changes value from '+Inff' to '9223372036854775807' [-Woverflow]
   27 |     ll ans = INFINITY;
      |              ^~~~~~~~
/usr/bin/ld: /tmp/ccuzVv4P.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccklpg8Q.o:quality.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccuzVv4P.o: in function `main':
grader.cpp:(.text.startup+0xe9): undefined reference to `rectangle(int, int, int, int, int (*) [3001])'
collect2: error: ld returned 1 exit status