Submission #503612

# Submission time Handle Problem Language Result Execution time Memory
503612 2022-01-08T12:29:56 Z LouayFarah Quality Of Living (IOI10_quality) C++14
0 / 100
2 ms 332 KB
#include "bits/stdc++.h"

using namespace std;

#define endl "\n"
#define ll long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second

const long long MOD = 1e9+7;
const long long INF = 1e18;

int nx[4] = {0, 0, -1, 1};
int ny[4] = {1, -1, 0, 0};

int rectangle(int r, int c, int h, int w, int q[3001][3001])
{
    int res = 1e8;

    /*for(int i = 0; i<=r-h; i++)
    {
        for(int j = 0; j<=c-w; j++)
        {
            set<int> arr;
            for(int k = i; k<h+i; k++)
            {
                for(int t = j; t<w+j; t++)
                {
                    arr.insert(q[k][t]);
                }
            }

            int len = int(arr.size());
            int curr = *next(arr.begin(),len/2);

            res = min(res, curr);
        }
    }*/

    for(int i = 0; i<=r-h; i++)
    {
        set<int> arr;
        for(int k = i; k<h+i; k++)
        {
            for(int j = 0; j<w; j++)
            {
                arr.insert(q[k][j]);
            }
        }

        int len = int(arr.size());
        int curr = *next(arr.begin(), len/2);
        res = min(res, curr);

        for(int j = 0; j<c-w; j++)
        {
            for(int k = i; k<h+i; k++)
            {
                arr.erase(q[k][j]);
            }
            for(int k = i; k<h+i; k++)
            {
                arr.insert(q[k][j+w]);
            }

            int len = int(arr.size());
            int curr = *next(arr.begin(), len/2);
            cout << curr << endl;

            res = min(res, curr);
        }
    }

    return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -