# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
837122 |
2023-08-25T01:26:13 Z |
kebine |
Orchard (NOI14_orchard) |
C++17 |
|
50 ms |
11988 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
const int N = 2e5 + 5;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n, m, ans = 0;
cin >> n >> m;
vector<vector<int>> a(n + 1, vector<int>(m + 1));
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cin >> a[i][j];
if (a[i][j] == 1) ans--;
else a[i][j] = -1;
}
}
if (n == 1) {
int mx = 0, sum = 0;
for (int i = 1; i <= m; i++) {
sum = max(0, sum + a[1][i]);
mx = max(mx, sum);
}
cout << -1 * (ans + mx) << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
11988 KB |
Output is correct |
2 |
Correct |
47 ms |
11988 KB |
Output is correct |
3 |
Correct |
50 ms |
11988 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
1876 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
33 ms |
3284 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |