Submission #1039955

#TimeUsernameProblemLanguageResultExecution timeMemory
1039955Ice_manQuality Of Living (IOI10_quality)C++14
Compilation error
0 ms0 KiB
/**
 ____    ____    ____    __________________    ____    ____    ____
||I ||  ||c ||  ||e ||  ||                ||  ||M ||  ||a ||  ||n ||
||__||  ||__||  ||__||  ||________________||  ||__||  ||__||  ||__||
|/__\|  |/__\|  |/__\|  |/________________\|  |/__\|  |/__\|  |/__\|

*/

#include <iostream>
#include <chrono>
#include "quality.h"


#define maxn 3005
#define maxlog 20
#define INF 1000000010
#define LINF 1000000000000000005
#define endl '\n'
#define pb(x) push_back(x)
#define X first
#define Y second
#define control cout<<"passed"<<endl;

#pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math")
#pragma GCC target("avx2")

using namespace std;


typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;
typedef pair <ll, ll> pll;
typedef pair <int, ll> pil;
typedef pair <ll, int> pli;
typedef long double pd;


std::chrono::high_resolution_clock::time_point startT, currT;
constexpr double TIME_MULT = 1;

double timePassed()
{
    using namespace std::chrono;
    currT = high_resolution_clock::now();
    double time = duration_cast<duration<double>>(currT - startT).count();
    return time * TIME_MULT;
}


int pref[maxn][maxn];
int a[maxn][maxn];
int n, m, h, w;

bool check(int x)
{
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
        {
            pref[i][j] = 0;
            pref[i][j] = pref[i][j - 1] + pref[i - 1][j] - pref[i - 1][j - 1];
            if(x >= a[i][j])
                pref[i][j]++;
        }

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            if(i - h >= 0 && j - w >= 0)
            {
                int pom = pref[i][j] + pref[i - h][j - w] - pref[i - h][j] - pref[i][j - w];
                if(pom * 2 > n * m)
                    return true;
            }
    return false;
}






int rectangle(int R, int C, int H, int W, int Q[maxn][maxn])
{
    n = R;
    m = C;
    h = H;
    w = W;

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            a[i][j] = Q[i][j];

    int l = 1, r = n * m;
    int ans = 0;

    while(l <= r)
    {
        int mid = (l + r) / 2;

        if(check(mid) == true)
        {
            r = mid - 1;
            ans = mid;
        }
        else
            l = mid + 1;
    }

    return ans;
}











/**int main()
{

    #ifdef ONLINE_JUDGE /// promeni
        freopen("taxi.in", "r", stdin);
        freopen("taxi.out", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    startT = std::chrono::high_resolution_clock::now();


    read();
    solve();

    return 0;
}
*/

Compilation message (stderr)

/usr/bin/ld: /tmp/ccLoMBfU.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