# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
691808 |
2023-01-31T15:26:46 Z |
phathnv |
Orchard (NOI14_orchard) |
C++11 |
|
164 ms |
10100 KB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<vector<int>> a(n, vector<int>(m));
int num1 = 0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
cin >> a[i][j];
num1 += a[i][j];
}
}
int res = num1;
vector<int> s(m);
for (int x1 = 0; x1 < n; ++x1) {
fill(s.begin(), s.end(), 0);
for (int x2 = x1; x2 < n; ++x2) {
int cur = 0, sum = 0;
for (int i = 0; i < m; ++i) {
sum += (a[x2][i]? -1 : +1);
s[i] += sum;
res = min(res, num1 + s[i] - cur);
cur = max(cur, s[i]);
}
}
}
cout << res << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
460 KB |
Output is correct |
2 |
Correct |
1 ms |
456 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
64 ms |
10100 KB |
Output is correct |
2 |
Correct |
108 ms |
9980 KB |
Output is correct |
3 |
Correct |
56 ms |
9992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
1872 KB |
Output is correct |
2 |
Correct |
12 ms |
1868 KB |
Output is correct |
3 |
Correct |
12 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
388 KB |
Output is correct |
2 |
Correct |
5 ms |
324 KB |
Output is correct |
3 |
Correct |
6 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
156 ms |
4736 KB |
Output is correct |
2 |
Correct |
164 ms |
4736 KB |
Output is correct |
3 |
Correct |
161 ms |
4736 KB |
Output is correct |