Submission #208956

# Submission time Handle Problem Language Result Execution time Memory
208956 2020-03-12T18:27:31 Z 2Nor22 Quality Of Living (IOI10_quality) C++14
Compilation error
0 ms 0 KB
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <cstdint>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <vector>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <tuple>
#include <list>
#include <set>
#include <map>
#define add push_back
#define m_p make_pair
#define fr first
#define sc second
#define endl '\n'
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
typedef long double ld;
typedef pair<ll, ll> pii;
const ll N = 1000005, mod = 998244353, M = 3005;
ll n, m, k, i, j, ans, kaskad[N], matrix[M][M], quality[M][M], pref[M][M];
ll h, w;
bool check(ll value)
{
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			int x = 0;
			if (matrix[i][j] > value)
				x = 1;
			else if(matrix[i][j] < value)
				x = -1;
			pref[i + 1][j + 1] = pref[i][j + 1] + pref[i + 1][j] - pref[i][j] + x;
		}
	}
	for (int i = h; i <= n; ++i)
	{
		for (int j = w; j <= m; ++j)
		{
			if (pref[i][j] - pref[i - h][j] - pref[i][j - w] + pref[i - h][j - w] <= 0)
				return true;
		}
	} 
	return false;
}
void BinarySearch(ll left, ll right)
{
	ans = right;
	if (right - left <= 1)
		return;
	ll mid = (left + right) / 2;
	if (!check(mid))
	{
		BinarySearch(mid, right);
	}
	else
	{
		BinarySearch(left, mid);
	}
}
int rectangle(int n, int m, int hh, int ww, int a[3001][3001]) {
    n = r;
  	m = c;
  	h = hh;
  	w = ww;
	for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < m; j++)
        {
            matrix[i][j] = a[i][j];
        }
	}
  	BinarySearch(0, h*w);
	return ans;
}

Compilation message

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:76:9: error: 'r' was not declared in this scope
     n = r;
         ^
quality.cpp:77:8: error: 'c' was not declared in this scope
    m = c;
        ^