/*
ID: samikgo1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define f first
#define s second
//#define x first
//#define y second
const int INF = INT32_MAX;
#include "quality.h"
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
ll ans = INFINITY;
for (int i = 0; i <= R-H; i++) {
for (int j = 0; j <= C-W; j++) {
vector<ll> quality;
for (int k = i; k < i+H; k++) {
for (int l = j; l < j+W; l++) {
quality.emplace_back(Q[k][l]);
}
}
sort(all(quality));
ans = min(ans,quality[quality.size()>>1]);
}
}
return ans;
}
//
//int main() {
// ios_base::sync_with_stdio(false);
// cin.tie(nullptr);
//// freopen("haybales.in","r",stdin);
//// freopen("haybales.out","w",stdout);
// ll r,c,h,w;
// cin >> r >> c >> h >> w;
// vector<vector<ll>> grid(r,vector<ll>(c));
// for(auto&i:grid)for(ll&j:i)cin>>j;
// ll ans = INFINITY;
// for (int i = 0; i <= r-h; i++) {
// for (int j = 0; j <= c-w; j++) {
// vector<ll> quality;
// for (int k = i; k < i+h; k++) {
// for (int l = j; l < j+h; l++) {
// quality.emplace_back(grid[k][l]);
// }
// }
// sort(all(quality));
// ans = min(ans,quality[quality.size()>>1]);
// }
// }
// cout << ans;
//}
Compilation message
quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:19:14: warning: overflow in conversion from 'float' to 'll' {aka 'long long int'} changes value from '+Inff' to '9223372036854775807' [-Woverflow]
19 | ll ans = INFINITY;
| ^~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
250 ms |
852 KB |
Output is correct |
5 |
Correct |
196 ms |
844 KB |
Output is correct |
6 |
Correct |
143 ms |
884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
250 ms |
852 KB |
Output is correct |
5 |
Correct |
196 ms |
844 KB |
Output is correct |
6 |
Correct |
143 ms |
884 KB |
Output is correct |
7 |
Execution timed out |
5061 ms |
2956 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
250 ms |
852 KB |
Output is correct |
5 |
Correct |
196 ms |
844 KB |
Output is correct |
6 |
Correct |
143 ms |
884 KB |
Output is correct |
7 |
Execution timed out |
5061 ms |
2956 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
250 ms |
852 KB |
Output is correct |
5 |
Correct |
196 ms |
844 KB |
Output is correct |
6 |
Correct |
143 ms |
884 KB |
Output is correct |
7 |
Execution timed out |
5061 ms |
2956 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |