# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
950680 |
2024-03-20T15:02:34 Z |
Irate |
Orchard (NOI14_orchard) |
C++14 |
|
26 ms |
860 KB |
#include<bits/stdc++.h>
using namespace std;
const int mxN = 155;
const int mxM = 155;
int grid[mxN][mxM], pref[mxN][mxM];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
for(int i = 1;i <= n;++i){
for(int j = 1;j <= m;++j){
cin >> grid[i][j];
pref[i][j] = pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1] + grid[i][j];
}
}
int res = 1e9;
for(int k = 1;k <= n;++k){
for(int i = 1;i + k - 1 <= n;++i){
int mn = -1;
for(int j = 1;j <= m;++j){
int sum = pref[i + k - 1][j] - pref[i - 1][j];
res = min(res, j * k - 2 * sum + pref[n][m] + k + mn);
mn = min(mn, 2 * (pref[i + k - 1][j] - pref[i - 1][j]) - k * (j + 1));
}
}
}
cout << res << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
860 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
860 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
4 ms |
604 KB |
Output is correct |
3 |
Correct |
4 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
26 ms |
856 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |