Submission #837121

# Submission time Handle Problem Language Result Execution time Memory
837121 2023-08-25T01:25:49 Z devariaota Orchard (NOI14_orchard) C++17
13 / 25
57 ms 12116 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 1 ms 212 KB Output is correct
2 Correct 1 ms 260 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 12116 KB Output is correct
2 Correct 57 ms 12116 KB Output is correct
3 Correct 49 ms 12116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 10 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 4692 KB Output isn't correct
2 Halted 0 ms 0 KB -