//control+option+n to run!
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define FOR(i, a, b) for (signed long long i = (signed long long)(a); i < (signed long long)(b); i++)
#define NEGFOR(i, a, b) for (ll i = (a); i > (b); i--)
#define vll vector<long long>
#define sll set<long long>
#define ld long double
#define inf 1000000000000000000
#define mll multiset<long long>
#define vpll vector<pll>
#define nn << "\n"
#define ss << " "
#define F(i, b) for (ll i = 0; i < b; i++)
//10^8 operations per second
//greatest int is 2,147,483,647
//greates long long is 9.22337204e18
//ALL FUNCTIONS SHOULD BE LL!!!!
ll power(ll x, ll n, ll m)
{
assert(n >= 0);
x %= m; //note: m*m must be less than 2^63 to avoid ll overflow
ll res = 1;
while (n > 0)
{
if (n % 2 == 1) //if n is odd
res = res * x % m;
x = x * x % m;
n /= 2; //divide by two
}
return res;
}
ll log(ll base, ll number)
{
int x = base;
int count = 1;
while (base < number)
{
base *= x;
count++;
}
return count;
}
int rectangle(int r, int c, int h, int w, int p[3001][3001])
{
ll ans=inf;
FOR(i,0,r-h+1){
FOR(j,0,c-w+1){
vll v;
FOR(a,0,h){
FOR(b,0,w){
v.pb(p[a+i][j+b]);
// cout<<(p[a+i][j+b]) nn;
}
}
sort(v.begin(),v.end());
ans=min(ans, v[h*w/2]);
}
}
return ans;
}
/*
int q[3001][3001];
#define oi
int main()
{
#ifdef oi
ifstream cin("grader.in.0");
ofstream cout("grader.expect.0");
#endif
#ifndef oi
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#endif
int r, c, h, w;
cin >> r >> c >> h >> w;
FOR(i, 0, r)
{
FOR(j, 0, c)
{
cin >> q[i][j];
}
}
cout << rectangle(r, c, h, w, q);
}
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
492 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
1 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
492 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
1 ms |
492 KB |
Output is correct |
4 |
Correct |
291 ms |
876 KB |
Output is correct |
5 |
Correct |
225 ms |
996 KB |
Output is correct |
6 |
Correct |
164 ms |
876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
492 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
1 ms |
492 KB |
Output is correct |
4 |
Correct |
291 ms |
876 KB |
Output is correct |
5 |
Correct |
225 ms |
996 KB |
Output is correct |
6 |
Correct |
164 ms |
876 KB |
Output is correct |
7 |
Execution timed out |
5061 ms |
3924 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
492 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
1 ms |
492 KB |
Output is correct |
4 |
Correct |
291 ms |
876 KB |
Output is correct |
5 |
Correct |
225 ms |
996 KB |
Output is correct |
6 |
Correct |
164 ms |
876 KB |
Output is correct |
7 |
Execution timed out |
5061 ms |
3924 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
492 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
1 ms |
492 KB |
Output is correct |
4 |
Correct |
291 ms |
876 KB |
Output is correct |
5 |
Correct |
225 ms |
996 KB |
Output is correct |
6 |
Correct |
164 ms |
876 KB |
Output is correct |
7 |
Execution timed out |
5061 ms |
3924 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |