답안 #420046

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
420046 2021-06-08T03:08:48 Z Lam_lai_cuoc_doi 삶의 질 (IOI10_quality) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

constexpr bool typetest = 0;
constexpr int N = 4e5 + 2;
#include "grader.h"
#include "quality.h"

int b[3001][3001];

int rectangle(int m, int n, int h, int w, int **a)
{
    auto Check = [&](int v)
    {
        for (int i = 1; i <= m; ++i)
            for (int j = 1; j <= n; ++j)
                b[i][j] = (a[i][j] >= v) + b[i - 1][j] + b[i][j - 1] - b[i - 1][j - 1];

        for (int i = h; i <= m; ++i)
            for (int j = w; j <= n; ++j)
                if ((b[i][j] - b[i - h][j] - b[i][j - w] + b[i - h][j - w]) < (h * w + 1) / 2)
                    return false;

        return true;
    };

    int l = 1, m, h = m * n;

    while (l <= h)
    {
        m = (l + h) / 2;

        if (Check(m))
            l = m + 1;
        else
            h = m + 1;
    }

    return h;   
}

Compilation message

quality.cpp: In function 'int rectangle(int, int, int, int, int**)':
quality.cpp:31:16: error: declaration of 'int m' shadows a parameter
   31 |     int l = 1, m, h = m * n;
      |                ^
quality.cpp:15:19: note: 'int m' previously declared here
   15 | int rectangle(int m, int n, int h, int w, int **a)
      |               ~~~~^
quality.cpp:31:19: error: declaration of 'int h' shadows a parameter
   31 |     int l = 1, m, h = m * n;
      |                   ^
quality.cpp:15:33: note: 'int h' previously declared here
   15 | int rectangle(int m, int n, int h, int w, int **a)
      |                             ~~~~^